Laravel : App::setLocale doesn’t work

I’m using laravel 5.1, I’m trying to update locale in app file like this : In Locale Middleware file : … public function handle($request, Closure $next) { if(Session::has(‘locale’…

Laravel 5.1 – BelongsTo relationship returns null

AppUser class User public function status() { return $this->belongsTo(‘AppUserStatus’, ‘user_status_id’, ‘id’); } AppUserStatus class UserStatus protected $fillable = [‘id’]; public …

Object of class IlluminateDatabaseEloquentBuilder could not be converted to string in laravel 5.1

I have been trying to debug a problem for the past two days, my code, as follows, is first attempting to retrieve the category by it’s id: $term = category::get([‘id’]); Then using this retrieved …

artisan migration error “Class ‘Doctrine\DBAL\Driver\PDOMySql\Driver’ not found”,

When trying to run a migration I get the error Artisan migration error:Class ‘Doctrine\DBAL\Driver\PDOMySql\Driver’ not found I have read the questions here and also see the notes to add: …

Xdebug laravel artisan commands

I regularly use xdebug to debug applications, I’ve built a laravel application that takes an upload of a csv inserts the data to the database and the ids to a job queue. I’ve written an artisan …

Laravel findOrFail with related data?

In my Menu controller I have a method which should display the specified record and all its children. I have two models: MenuItem and MenuVariation, My items will have many variations as outlined in …

How to get client IP address in Laravel 5+

I am trying to get the client’s IP address in Laravel. It is easy to get a client’s IP in PHP by using $_SERVER[“REMOTE_ADDR”]. It is working fine in core PHP, but when I use the same thing in …

Laravel Image Quality

Every time I upload a new image to my server, this image is resized. The main issue I’m having is that the image is losing a lot of quality. This is the current code: $name1 = str_random(10); …

Eloquent chunk() missing half the results

I have a problem with Laravel’s ORM Eloquent chunk() method. It misses some results. Here is a test query : $destinataires = Destinataire::where(‘statut’, ‘where(‘tokenized_at’, ‘&…

Execute Laravel/Symfony/Artisan Command in Background

I need to execute a Laravel long running process in the background for consuming the Twitter Streaming API. Effectively the php artisan CLI command I need to run is nohup php artisan startStreaming &…