Important Point in Laravel

isset in blade file

<input type="hidden" name="city_id" value="{{ isset($city) ? $city : null }}">

session set and flash message

 \Session::flash('flash_message', 'Order not delivered on your postal code');             


Set Session

\Session::put('slug', 'value');

$value = session('slug');

Check exist session
if (Session::has('slug')) { // }
Redirect back

\Redirect::back();


delete file in laravel

\File::delete(public_path() .'/upload/restaurants/'.$restaurant_obj->restaurant_logo.'.jpg');

Remove html tags from description

{!!$testimonial->description!!}  // remove the html tags
-------------------------------------------------------------------------------------------------------------------------
Slug in laravel
$restaurant_slug = str_slug($inputs['restaurant_name'], "-");

Redirect with id using URL::to
{{URL::to('restaurants/menu/'.$restaurant->restaurant_slug)}}
----------------------------------------------------------------------------------------------------------------------------
return redirect('/login')->success('Login to access the site.');
return redirect('/login')->withErrors('your activation code or link is wrong

{{Request::path()}} // request path
active link in menu
{{ Request::is('/') ? 'active' : '' }}

Comments

Popular Posts