laravel tips and tricks 2021 code example

Example 1: laravel tricks and tips

Route::get('logout', function()
{
    Auth::logout();
     
    return Redirect::home();
});
//@sujay

Example 2: laravel tricks and tips

Route::get('orders', function()
{
    return View::make('orders.index')
        ->with('orders', Order::all());
});
//@sujay

Example 3: laravel tricks and tips

Article::find($article_id)->increment('read_count');
Article::find($article_id)->increment('read_count', 10); // +10
Product::find($produce_id)->decrement('stock'); // -1
//@sujay

Tags:

Php Example