4. 4
Task 1 :- Install Composer.
- Go to http://getcomposer.org/ and download.
Author : Vikas Chauhan
5. 5
Task 2 :- Install & configure Laravel
Via Composer Create-Project :- Using commend composer create-
project laravel/laravel [directory]
(see:- http://www.youtube.com/watch?v=DD_-
l5AZY1A&feature=youtu.be )
Using commend install composer ( see:-
http://www.youtube.com/watch?v=WW1CPLOzRH4&feature=youtu.be
)
Generate key :- using commend php artisan key:generate (see :-
http://www.youtube.com/watch?v=87bYRrzCSUw&feature=youtu.be )
Copy that unique generate key and paste into ‘app/config/app.php
file.
Rename ‘server.php’ to ‘index.php’ .
Author : Vikas Chauhan
6. 6
Task 3 :- Run Laravel
Enter the url http://localhost/laravellab/public/ on
browser. (url should be change according to your localhost path.)
Author : Vikas Chauhan
22. 22
Echo by route:- route.php
Route::get (‘about’, function() {
return “hello world”;
});
Echo by view:-
in view folder create a php file named hello
route.php :-
Route::get (‘/’, function() {
return view::make(‘hello’);
});
Author : Vikas Chauhan
23. 23
Echo by only controller:-
route.php :-
Route::resource(‘demo1’, ‘controllername);
In controller
<?php class DemoController extends BaseController
{
public function get_index()
{
echo ‘hello world’;
}
}
Author : Vikas Chauhan
24. 24
Echo by controller and view:-
route.php :-
Route::controller(‘demo1’, ‘controllername);
In controller :-
<?php class DemoController extends BaseController
{
public function get_index()
{
$View= View::make('demo1.index' , array(
'name'=>’laravel user ‘ )) ;
return $View;
}
}
In view :- create a folder named demo1 and make a php fiile named
index.php
Author : Vikas Chauhan
25. 25
Restful route:-
route.php :-
Route::controller(‘pathname’, ‘controllername@function_name’);
In controller :-
<?php class DemoController extends BaseController
{
public function get_index()
{
$View= View::make('demo1.index' , array(
'name'=>’laravel User ‘ )) ;
return $View;
}
}
In view :- create a folder named demo1 and make a php fiile named
index.php
Author : Vikas Chauhan