How to set layout in laravel

http://scotch.io/tutorials/simple-laravel-layouts-using-blade

Advertisements

how to display error success message in laravel

Message pass In your controller:

return Redirect::to(‘account’)->with(‘alert-success’, ‘You are now logged in.’);

Message Display In your view:

@if ($alert = Session::get(‘alert-success’))
<div class=”alert alert-warning”>
{{ $alert }}
</div>
@endif

Hope this helps.

 

Note:- Please replace ` ` to ‘ ‘ before use

Laravel : how to retrieve database table in laravel

how to retrieve database tableĀ  in laravel :-
Go to database.php & configure your database
Directory :- app/config/database.php

controller :
$results = DB::select(‘select * from category’);
return View::make(‘pages.category’)->with(‘results’, $results);

view :

@foreach($results as $result)
<li>
{{$result->name}}
</li>
@endforeach

 

Note:- Please replace ` ` to ‘ ‘ before use

Laravel : how to add stylesheets and javascript link in laravel

Easy to linkupĀ  CSS , JS & Favicon.ico
(1). Adding CSS

HTML::style will link to your project/public/ folder

{{ HTML::style(‘css/bootstrap.css’) }}

(2). Adding JS

HTML::script will link to your project/public/ folder

{{ HTML::script(‘js/script.js’) }}

(3). Adding favicon.ico
<link rel=”shortcut icon” href=”{{ asset(‘asset/css/images/favicon.ico’); }}”>

 

 

Note:- Please replace ` ` to ‘ ‘ before use