mercredi 29 novembre 2017

In laravel eloquent create method i am not able to save the data in database

I have Three model -> Language-> Article-> Category.. Article table has two Foreign Key category_id & Language_id, Language-Model has "One to Many" Relationship with Article-Model, Similarly Category-Model has "One to Many" Relationship with Article-Model.

Category- Model

class Category extends Model
            { 

            protected $fillable = [
                 'category_name', 
            ];

            public function articles(){

                return $this->hasMany('App\Article');
             }
           }

Language-Model

class Language extends Model
    {
         protected $fillable = [
            'language_name'
        ];

         public function articles(){

            return $this->hasMany('App\Article');
        }

    }

Article _model

class Article extends Model
{
 protected $fillable = [

   'language_id','category_id','category_name','article_title',
   'article_desc','source_from','source_url','video_link',
   'audio_url','author_name','article_image_url','like_count'
    ];

    public function languages(){

        return $this->belongsTo('App\Language');
    }

    public function categories(){

        return $this->belongsTo('App\Category');
    }

}

How to insert in the database using laravel Eloquent

 $Article = new Article (
                 [
                   'article_image_url' => $img_url ,
                   'audio_url' => $audio_url,
                   'category_name'=>$category_name ,
                   'article_title'=>$request->article_title,
                   'article_desc'=>$request->article_desc,
                   'source_from'=>$request->source_from,
                    'source_url'=>$request->source_url,
                    'video_link'=>$request->video_link,
                    'author_name'=>$request->author_name,
                    'like_count'=>'0',

                  ]
            );

            $language = new Language;
            $category = new Category;
            $language->articles()->save($Article);

since language_id doesn't have a default value it is foreign key please help me out with this



via Chebli Mohamed

mardi 28 novembre 2017

output only updated after second form submit

I have a from with an input that filters a database query by a string. Often, but strangely enough not always, I have to send this form twice to get updated data after changing the filter string. The filter string is updated upon sending the form in because I flash the request. So that part works.

In between sending the forms there is also an ajax call to the same route (json return). Maybe that is mixing something up with the csrf tokens?

Why is the data not updated? It seems it is cached? I followed the basic tutorial. (I know the code is not perfect, it's my first laravel project)

Here is the route: (I change the real name of the model to "Model")

Route::get('myRoute', ['as' => 'myRoute', function (\Illuminate\Http\Request $request) {
    $request->flash();
    $model = new \App\Model();

    if($request->accepts('text/html')) {
        if($request->has('filter')) {
            $searchString = $request->filter;
        } else {
            $searchString = '';
        }
        return view('myView', [
            'searchString' => $searchString,
            'models' => $model->getModels()
        ]);
    } elseif($request->accepts('application/json')) {
        return response()->json($model->getModels());
    }
}]);

And here the relevant part of the Model:

namespace App;

use Illuminate\Database\Eloquent\Model;

class Model extends Model
{
    public function getRequests()
    {

        if (request()->has('filter')) {
            return $this->searchByFilter();
        }

        if (request()->has('email')) {
            return $this->searchByEmail();
        }
    }

    private function searchByFilter()
    {
        $filter = request();
        if (is_null($filter)) {
            return $this->orderBy('created', 'asc')->get();
        }
        return $this->selectRaw(
            "*, MATCH(
                    something
                ) AGAINST ('{$filter}' IN NATURAL LANGUAGE MODE) as relevance")
            ->whereRaw("MATCH(
                            something
                        ) AGAINST ('{$filter}' IN NATURAL LANGUAGE MODE)")
            ->orderBy('relevance', 'desc')
            ->limit(25)
            ->get();
    }
}

The view is very simple:

@if (!is_null($models))
    @forelse ($models as $key => $model)
        <div></div
    @empty
        <p>no results.</p>
    @endforelse
@else
    <p>please filter something.</p>
@endif



via Chebli Mohamed

lundi 27 novembre 2017

Dynamic Bootstrap-date-picker-sandbox highlight specific date

Currently in a Calendar i am setting background color on static date. In my for loop i am getting array:

// BookeData loop 
@if(!empty($BookeData))
        @foreach($BookeData as $key => $value)
            // getting single venue booked date 
            // Flag : 1 - for 1st half, 2 - for 2nd half and 3 - for full day 
        @endforeach
@endif

On below script i want to set it dynamically , on a booked date and $value->session == 1 then apply gradient css red and green..if session value 2 vice versa css apply..if 3 apply full colour css.

My Script which is working on static date is

<script type="text/javascript">
var booked_date = ["27-11-2017","27-11-2017"]; 
$("#datepicker").datepicker({
 format: "dd/mm/yyyy",
 autoclose: true,

    beforeShowDay: function(date){
    var d = date;
    var curr_date = d.getDate();
    var curr_month = d.getMonth() + 1; //Months are zero based
    var curr_year = d.getFullYear();
    var formattedDate = curr_date + "-" + curr_month + "-" + curr_year
    if ($.inArray(formattedDate, booked_date) != -1){
       return {
          classes: 'activeClass'
       };
     }
  return;
}
});

Active class css

.activeClass{
  background: -webkit-linear-gradient(red, yellow); 
  background: -o-linear-gradient(red, yellow); 
  background: -moz-linear-gradient(red, yellow);  
  background: linear-gradient(red, yellow);  

}

How can i do this dynamically on my array.!! Thanks in advance.



via Chebli Mohamed

L5.1 - Command with localization not working (not in Ubuntu but yes on Mac)

I have a command called SendReminders, when I change the locale with App::setLocale('locale') it looks like is working because when I do App::getLocale() returns the correct one, but when I call for a translation returns always the default localization.

This is my SendReminders class:

<?php namespace App\Console\Commands;

use Illuminate\Console\Command;

use App;
use Exception;
use Storage;
use Lang;

class SendReminders extends Command
{

    protected $signature = 'send:reminders';

    public function __construct(){
        parent::__construct();
    }

    public function handle(){

        App::setLocale('EN');
        echo App::getLocale()."\n"; // <= Shows correctly 'EN'
        echo Lang::get('general.contact')."\n"; // <= Shows correctly 'Contact'

        App::setLocale('DE');
        echo App::getLocale()."\n"; // <= Shows correctly 'DE'
        echo Lang::get('general.contact')."\n"; // <= Doesn't show the correct value

    }

}

I'm missing something to make the localization work?

EDIT:

Some estrange behavior is happening because on my Mac is working but on Linux (Ubuntu) is not, looks like is not finding my folder /resources/lang/de/



via Chebli Mohamed

vendredi 24 novembre 2017

i am trying to show affiliate program banner in laravel 5.1 with widgetify liabrary, but it is not showing banner

I am just trying to show banner of affiliate program in laravel 5.1. But its not showing that banner.As per google search i found widgetify package and implemented it successfully but still unable to view banner with this html and script code.

This is my code to show banner:

<div data-WRID="WRID-151136341816463865" data-widgetType="productBanner" data-class="affiliateAdsByFlipkart" height="240px" width="120px"></div>
<script async src="//affiliate.flipkart.com/affiliate/widgets/FKAffiliateWidgets.js"></script>

and when i am print it in wordpress its working fine.



via Chebli Mohamed

jeudi 23 novembre 2017

response with appropriate mime type requested with accept

Say I have a route:

Route::get('list',...);

If I call that route with Accept: text/html it should return a view with all the blade hoopla. If I call that route with Accept: application/json it should return json, Accept: application/xml it will return xml. And so on...

How do I realise that with Laravel 5.1?



via Chebli Mohamed

mercredi 22 novembre 2017

post image to webservice using cURL in laravel

I want post $data and $fileData to the webservice using cURL

Any one can help.

This is my code :

$data = $request->bodyData;
$fileData = image file;

$postfields = array();
$postfields['data'] = $data;
$postfields['fileData'] = $fileData;


 $ch = curl_init();

 curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data'));
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $output = curl_exec($ch);

 curl_close($ch);



via Chebli Mohamed

'Yajra\Datatables\DatatablesServiceProvider' not found

Hi guys I am trying to fix this about 1 week and I am stucked here. I try a lot of things like: composer-dumpload, clearing cache, capitalizing service provider like this: Yajra\Datatables\DatatablesServiceProvider I run multiple versions of Yajra like 5 and 6.

Here is my app.config

Providers
    Illuminate\Validation\ValidationServiceProvider::class,
    Illuminate\View\ViewServiceProvider::class,
    Yajra\Datatables\DatatablesServiceProvider::class

Alias
    'Datatables' => Yajra\Datatables\Facades\Datatables::class,

So I don't know what more have to do. I have Laravel 5.1 version and must be this version and not a new one.

If we can help me with this I will be very happy.

Thanks



via Chebli Mohamed

laravel where not in

this is my mysql code

SELECT name,lastname FROM employee WHERE employee.id_employee
NOT IN (SELECT assistancea.id_employee FROM assistance WHERE assistance.id_meeting=3)

where I'm waiting for a value in number 3
3 is the id_meeting of meeting

table employe  
|id_employe|name|lastname

table assistance  
|id_employe|id_meetign|

table meeting  
|id_metting|description|date

You could help me make a query from laravel



via Chebli Mohamed

mardi 21 novembre 2017

Powerpoint charts needs repair

i'm currently working on a project where I need to create powerpoints online. I'm using http://ift.tt/1RIak9x for this. Almost everything works perfectly, besides generating charts. When I open the powerpoint, it says it needs repairing. After the repair all the content is lost.

I wondered if anybody else had the same problem and could help me solve this problem.

Code i tried:

    $oPHPPresentation = new PhpPresentation();
    $currentSlide = $oPHPPresentation->createSlide();
    $currentSlide->setName('Title of the slide');
    $lineChart = new Line();


    $seriesData = array('Monday' => 18, 'Tuesday' => 23, 'Wednesday' => 14, 'Thursday' => 12, 'Friday' => 20, 'Saturday' => 8, 'Sunday' => 10);
    $series = new Series('example', $seriesData);
    $series->setShowValue(false);
    $series->setShowPercentage(true); // This does nothing
    $series->setDlblNumFormat('0.00%'); // This does nothing

    $lineChart->addSeries($series);
    $shape = $currentSlide->createChartShape();
    $shape->getPlotArea()->setType($lineChart);

    $oWriterPPTX = IOFactory::createWriter($oPHPPresentation, 'PowerPoint2007');
    $oWriterPPTX->save(__DIR__ . "/sample.pptx");

Package: http://ift.tt/1RIak9x
framework: Laravel 5.1
php version: 7.0

Thanks in advance



via Chebli Mohamed

lundi 20 novembre 2017

how to highlight string in a string in a laravel blade view

Somewhere in my template I have this:



Now in this text I want to highlight all words that are in the string



So I thought I create a new blade directive:



Blade::directive('highlightSearch', function($input, $searchString)...

error: missing argument 2

Found out that directives do not except 2 arguments. I tried every workaround that I could find but none worked. They always return the arguments as a plain string, not even passing the actual values.

I tried adding a helper function like explained here: http://ift.tt/2zXcYGl. Did not work:

error: unknown function "highlightSearch"

So how do I do this super easy task in laravel? I don't care about the highlighting function, that's almost a one-liner.



via Chebli Mohamed

samedi 18 novembre 2017

linux server Creates cache and laravel project gone down

I have stuck in a problem that my laravel project deployed in linux server and server is creating cache in var directory. I run 'yum clean all' command but again creates cache. I run command php artisan cache:clear, php artisan route:clear but no result. is there any way to manage server cache? I face, the error is...

ErrorException in Filesystem.php line 81:
file_put_contents(): Only 0 of 255 bytes written, possibly out of free disk space

my project size is 120 mb.



via Chebli Mohamed

vendredi 17 novembre 2017

Laravel Redis Queue - Reserved jobs not removed on failure

I'm using redis as the queue driver for Laravel 5.1. It seems that when a job fails due to a fatal error, such as an exceeded execution time, the reserved job is not removed from the queue. I can check in the redis-cli on the queues:default:reserved key that it's still there. And the job is reattempted over and over again instead of being deleted. I have two workers on the queue and retries are set to 1.

My artisan command is: artisan queue:listen --tries=1

The failed() method on the job is not called, nor is the Queue::failing() listener with the redis driver. These are not issues if I'm using the database driver.

Does anyone have any suggestions on what I should be looking for to solve this?



via Chebli Mohamed

jeudi 16 novembre 2017

Pass variable from custom Laravel Helpers to Blade file

I'm trying to create a helper to centralize a complicated Form::select.

My helper:

namespace App\Helpers;
use Log;
use App\Countries;

class Address {
    public static function country() {
        $countries = Countries::orderby('name_zh','asc');
        $form = "Form::select('countries', \$countries);";
        return $form;
    }
}

My View:

{!! Address::country() !!}

I would like to have this select form with $countries variable from this helper and show a Dropdown list on my view. How do I do it?



via Chebli Mohamed

mardi 14 novembre 2017

Error 500 when post data to database

I'm new in php and Laravel. I get error code 500 when I post my data.

this my form code in my blade :

    <form method="post" class="form-horizontal" id="form"
            action="">
            

and this is my method in my controller :

    public function store(Request $request)
{
    if($request->ajax()){
        $data = collect($request->all())
            ->except(['_token'])
            ->all();

        $akun = SetLinkAkunCoa::create($data);

        if($akun){
            $response = $this->returnSuccess('', trans('messages.success.update'));
            return response()->json($response);
        }else{
            $response = $this->returnData('', trans('messages.error.update'));
            return response()->json($response);
        }
    }
}

Please someone help me to solve this. thank's anyway



via Chebli Mohamed

dimanche 12 novembre 2017

FatalThrowableError in ServiceProvider.php line 49: Class 'Dompdf\Dompdf' not found

can i get some help to solve this problem, it works perfectly in my local, but in heroku i keep getting this error.

i tried:

heroku run php artisan cache:clear heroku run php artisan config:cache

But it did not work.

enter image description here

My providers, i am following the instructions to use Barryvdh\DomPDF:

'providers' => [

    /*
     * Laravel Framework Service Providers...
     */
    Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
    Illuminate\Auth\AuthServiceProvider::class,
    Illuminate\Broadcasting\BroadcastServiceProvider::class,
    Illuminate\Bus\BusServiceProvider::class,
    Illuminate\Cache\CacheServiceProvider::class,
    Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
    Illuminate\Routing\ControllerServiceProvider::class,
    Illuminate\Cookie\CookieServiceProvider::class,
    Illuminate\Database\DatabaseServiceProvider::class,
    Illuminate\Encryption\EncryptionServiceProvider::class,
    Illuminate\Filesystem\FilesystemServiceProvider::class,
    Illuminate\Foundation\Providers\FoundationServiceProvider::class,
    Illuminate\Hashing\HashServiceProvider::class,
    Illuminate\Mail\MailServiceProvider::class,
    Illuminate\Pagination\PaginationServiceProvider::class,
    Illuminate\Pipeline\PipelineServiceProvider::class,
    Illuminate\Queue\QueueServiceProvider::class,
    Illuminate\Redis\RedisServiceProvider::class,
    Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
    Illuminate\Session\SessionServiceProvider::class,
    Illuminate\Translation\TranslationServiceProvider::class,
    Illuminate\Validation\ValidationServiceProvider::class,
    Illuminate\View\ViewServiceProvider::class,
    //Para configurar laravel Collective
    Collective\Html\HtmlServiceProvider::class,
    //Generar pdfs en la aplicacion
    Barryvdh\DomPDF\ServiceProvider::class,

    /*
     * Application Service Providers...
     */
    noMasTattut\Providers\AppServiceProvider::class,
    noMasTattut\Providers\AuthServiceProvider::class,
    noMasTattut\Providers\EventServiceProvider::class,
    noMasTattut\Providers\RouteServiceProvider::class,

],

/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/

'aliases' => [

    'App'       => Illuminate\Support\Facades\App::class,
    'Artisan'   => Illuminate\Support\Facades\Artisan::class,
    'Auth'      => Illuminate\Support\Facades\Auth::class,
    'Blade'     => Illuminate\Support\Facades\Blade::class,
    'Bus'       => Illuminate\Support\Facades\Bus::class,
    'Cache'     => Illuminate\Support\Facades\Cache::class,
    'Config'    => Illuminate\Support\Facades\Config::class,
    'Cookie'    => Illuminate\Support\Facades\Cookie::class,
    'Crypt'     => Illuminate\Support\Facades\Crypt::class,
    'DB'        => Illuminate\Support\Facades\DB::class,
    'Eloquent'  => Illuminate\Database\Eloquent\Model::class,
    'Event'     => Illuminate\Support\Facades\Event::class,
    'File'      => Illuminate\Support\Facades\File::class,
    'Gate'      => Illuminate\Support\Facades\Gate::class,
    'Hash'      => Illuminate\Support\Facades\Hash::class,
    'Input'     => Illuminate\Support\Facades\Input::class,
    'Lang'      => Illuminate\Support\Facades\Lang::class,
    'Log'       => Illuminate\Support\Facades\Log::class,
    'Mail'      => Illuminate\Support\Facades\Mail::class,
    'Password'  => Illuminate\Support\Facades\Password::class,
    'Queue'     => Illuminate\Support\Facades\Queue::class,
    'Redirect'  => Illuminate\Support\Facades\Redirect::class,
    'Redis'     => Illuminate\Support\Facades\Redis::class,
    'Request'   => Illuminate\Support\Facades\Request::class,
    'Response'  => Illuminate\Support\Facades\Response::class,
    'Route'     => Illuminate\Support\Facades\Route::class,
    'Schema'    => Illuminate\Support\Facades\Schema::class,
    'Session'   => Illuminate\Support\Facades\Session::class,
    'Storage'   => Illuminate\Support\Facades\Storage::class,
    'URL'       => Illuminate\Support\Facades\URL::class,
    'Validator' => Illuminate\Support\Facades\Validator::class,
    'View'      => Illuminate\Support\Facades\View::class,
    //terminando configurar laravel collective
    'Form' => Collective\Html\FormFacade::class,
    'Html' => Collective\Html\HtmlFacade::class,
    //Facade para generar PDFs
    'PDF' => Barryvdh\DomPDF\Facade::class,

],

And my composer.json:

"require": {
    "php": "^7.0",
    "laravel/framework": "5.1.*",
    "laravelcollective/html": "5.1.*",
    "guzzlehttp/guzzle": "~5.3|~6.0",
    "barryvdh/laravel-dompdf": "^0.8.1",
    "doctrine/dbal": "^2.5"

},



via Chebli Mohamed

vendredi 10 novembre 2017

"A non-numeric value encountered" laravel5.1 php7.1 dompdf 0.8

I understood that this error was already solved but i don't manage to fix it, so sorry and thanks for your advises: I'm working on a Laravel 5.1 project (FusionInvoice) and use dompdf to create pdf files. My aim is to use php7.1 for this project.

After enable php7.1 I had the "A non-numeric value encountered" error so i did the easy installation procedure of dompdf, with composer method (http://ift.tt/13J3PJw) to fix it using the dompdf 0.8.1 release. My requierements seems ok.

Now i have this error:

FatalThrowableError in domPDF.php line 30: Class 'DOMPDF' not found

we are talking about this file "app/Support/PDF/Drivers/domPDF.php" and this function:

private function getPdf($html)
    {
        $pdf = new \DOMPDF();
        $pdf->set_paper($this->paperSize, $this->paperOrientation);
        $pdf->load_html($html);
        $pdf->render();

        return $pdf;
    }

I understood that the "new \DOMPDF();" is calling this file '/vendor/dompdf/dompdf/src/Dompdf.php' to build his object. so i tried this : "new \Dompdf\Dompdf();"

and i'm back to the first place:

ErrorException in Page.php line 499: A non-numeric value encountered

Does someone knows how i can solve this issue ? Thanks...



via Chebli Mohamed

lundi 6 novembre 2017

TokenMismatchException in VerifyCsrfToken.php line

i am using laravel 5.1 its working on localhost but not working on server getting error

TokenMismatchException in VerifyCsrfToken.php line 53:

here is my code link

http://ift.tt/2h7AGai

help me



via Chebli Mohamed

samedi 4 novembre 2017

Cannot upload image in Laravel 5.2

I make input data with an upload image, my code

$name   = $request->input('name');
$images = $request->file('image');
$name_img = $images->getClientOriginalName();
$ext = $images->getClientOriginalExtension();
// Move Uploaded File
$destinationPath = 'img/';
$images->move($destinationPath,$name_img);
$path = $destinationPath.'/'.$name_img;

then put them in array, then insert in database

$data = array(
'name' => $name,
'image' => $path, );
DB::table('daftar')->insert($data);
return json_encode(array('status' =>true));

That code works in Laravel 5.1, but it doesnt work in Laravel 5.2.

Anything wrong with that code for Laravel 5.2?

Thank You. :)



via Chebli Mohamed

vendredi 3 novembre 2017

Maatwebsite/Laravel-Excel issue with more data

im using Maatwebsite/Laravel-Excel for exporting data in a xls format. How ever its not responding for 20000+ records. Download request ended up in response.

There is a known issue in here. They have suggest to chunk the records, but in my case i used .blade files in laravel for generating the xls.

How can i use chunk with .blade?



via Chebli Mohamed

if else statement running like what i need something went wrong in laravel

i have 2 button accept and reject
when i die dump request is coming fine with accept id 2 and reject id 3 but i try to add if statement its bring me only accept skip reject

here is my code

 $interview = Interview::find($request->id);
    $user = Currentuser::where('id', $interview->CompanyID)->first();
    if ($request->Status = '2') {


                 $data = []; // Empty array

                Mail::send('email.useracceptjob', $data, function($message) use ($user){

                    $message->to($user->Email)->subject('Your Job Accepted By user');

                });
             }
             elseif ($request->Status = '3') {


                 $data = []; // Empty array

                Mail::send('email.userrejectjob', $data, function($message) use ($user){

                    $message->to($user->Email)->subject('Your Job Rejected By user');

                });
             }
             else{
                return response()->json(['code' => 500]);
             }

do i doing something wrong? Help me Please



via Chebli Mohamed

jeudi 2 novembre 2017

Laravel: Allow soft deleted models in a hasManyThrough relationship

I have a has many through relationship like this:

class Venue {
    public function orders()
    {
        return $this->hasManyThrough(Order::class, Offer::class);
    }
}

However the Offer model can be soft deleted: http://ift.tt/2iVGxUj

This means the function, will not return any orders that have a soft deleted offer.

How can I allow the function to return orders that have soft deleted offers.

Note that I am using Laravel 5.1 (although solutions in newer versions is appreciated).



via Chebli Mohamed

mercredi 1 novembre 2017

preg_match(): No ending delimiter '/' found Laravel

I'm doing a validation by regex from a request, this validation is to check that the parameter that is sent is an IP.

My rules are as follows:

  <?php

namespace App\Http\Requests\usuarios;

use Illuminate\Foundation\Http\FormRequest;

class storeVPN extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [            
            'segmentwan' => 'http://regex:/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/',
            'segmentlan' => 'http://regex:/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/',

        ];
    }

the debugger shows me that the error is in this line

the debugger shows me that the error is in this line

return preg_match($parameters[0], $value) > 0;

y el error completo es el siguiente

 * @return bool
     */
    public function validateRegex($attribute, $value, $parameters)
    {
        if (! is_string($value) && ! is_numeric($value)) {
            return false;
        }

        $this->requireParameterCount(1, $parameters, 'regex');

        return preg_match($parameters[0], $value) > 0;
    }

    /**
     * Validate that a required attribute exists.
     *
     * @param  string  $attribute
     * @param  mixed   $value
     * @return bool
     */
    public function validateRequired($attribute, $value)
    {
        if (is_null($value)) {
            return false;
        } elseif (is_string($value) && trim($value) === '') {
            return false;
        } elseif ((is_array($value) || $value instanceof Countable) && count($value) < 1) {
            return false;
        } elseif ($value instanceof File) {
            return (string) $value->getPath() !== '';
        }



via Chebli Mohamed

Connection could not be established with host on custom server

i am using laravel 5.1 & i am trying to send email after login but it show me error

Connection Could not be established with host mail.jobnow.com.sg

also try another host like gmail and other still same problem


How can i fix this



via Chebli Mohamed