Maintenance Mode without using Artisan?

You can just call artisan from your application: Artisan::call(‘down’); Artisan::call(‘up’); But since you’ll not have access to get your app up because it’s down. You can create the functionality yourself: A route for shut it down, user must be authenticated to do this: Route::group(array(‘before’ => ‘auth’), function() { Route::get(‘shut/the/application/down’, function() { touch(storage_path().’/meta/my.down’); }); }); A … Read more

multiple mail configurations

You can create a new Swift_Mailer instance and use that: // Backup your default mailer $backup = Mail::getSwiftMailer(); // Setup your gmail mailer $transport = Swift_SmtpTransport::newInstance(‘smtp.gmail.com’, 465, ‘ssl’); $transport->setUsername(‘your_gmail_username’); $transport->setPassword(‘your_gmail_password’); // Any other mailer configuration stuff needed… $gmail = new Swift_Mailer($transport); // Set the mailer as gmail Mail::setSwiftMailer($gmail); // Send your message Mail::send(); // Restore … Read more

Laravel commands and jobs

Console Commands Laravel has had console “commands” for some time. They are basically unchanged, and work as they always have. In simple terms, they are the equivalent of routes for the command line – the entry point into the application. They are in no way related to… The Command Bus Laravel 5.0 introduced an implementation … Read more

How to sort by a field of the pivot table of a many-to-many relationship in Eloquent ORM

Not sure if you plan to move to Laravel 4, but here’s an Eloquent example for sorting by a pivot tables fields: public function songs() { return $this ->belongsToMany(‘Song’) ->withPivot(‘play_count’) ->orderBy(‘pivot_play_count’, ‘desc’); } withPivot is like the eloquent with and will add the play_count field from the pivot table to the other keys it already … Read more

How to protect image from public view in Laravel 5?

It is possible to protect images from public view in Laravel 5.x folder. Create images folder under storage folder (I have chosen storage folder because it has write permission already that I can use when I upload images to it) in Laravel like storage/app/images. Move the images you want to protect from public folder to … Read more

Pluck with Where condition

I found the mistake. I should use pluck with where condition like below. $specialities = Speciality::where(‘role_id’,$request->roleid)->pluck(‘name’,’id’); Pluck won’t filter anything, but it gives only what needed. So filtering has to be done before that.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)