Category Archives: laravel
Install Laravel on Windows using laravel installer
You can simply use laragon to install laravel on windows.
Simple and easy Steps to Install Laravel on Windows using laravel installer
- Download laragon from http://laragon.org/
- Install on windows [run the setup laragon-0.6-setup.exe]
- After Sucessfull installation – Start all services and you will see dialog box like this
- Now right click on dialog box
- Now go to > laravel > create project > Laravel 5 >.
Now click on Laravel 5 it will show prompt asking to enter project name enter “laravel” ->
- Afer entering project name you will see cmd which will take few minutes to install the laravel .After finishing installation you will see like this-
- Now you can access your project by accessing the url http://laravel.dev or you can access normally http://localhost/laravel/public
- Now you will see you first project
- For managing application go to : Lamp_path \lamp\www\laravel for example i have installed lamb in G: drive for me application directory is G:\lamp\www\laravel
Laravel inserting multiple records in table
You can insert multiple records into table at a time in laravel.
Syntax for laravel inserting multiple records in table
DB::table('table_name')->insert(array('data_array1','data_array2'....));
Laravel inserting multiple records in table Example
DB::table('users')->insert(array( array("id"=>'1',"name"=>"john","email"=>"john@testgmail.com"), array("id"=>'2',"name"=>"Jimmi","email"=>"jimmn@testgmail.com"), array("id"=>'3',"name"=>"Kelly","email"=>"kelly@testgmail.com"), array("id"=>'4',"name"=>"Mike","email"=>"mike@testgmail.com"), array("id"=>'5',"name"=>"Steve","email"=>"steve@testgmail.com"), );
or You can also use this :
$data1 = array("id"=>'1',"name"=>"john","email"=>"john@testgmail.com"); $data2 = array("id"=>'2',"name"=>"Jimmi","email"=>"jimmn@testgmail.com"); $data3 = array("id"=>'3',"name"=>"Kelly","email"=>"kelly@testgmail.com"); $data4 = array("id"=>'4',"name"=>"Mike","email"=>"mike@testgmail.com"); $data5 = array("id"=>'5',"name"=>"Steve","email"=>"steve@testgmail.com"); DB::table('users')->insert(array($data1,$data2,$data3,$data4,$data5,));
Laravel insert query
Laravel insert query : Laravel Insert Records Into A Table
Syntax for laravel insert Query
DB::table('table_name')->insert('data_array');
Laravel insert Query Example
DB::table('users')->insert(array("id"=>$uid,"name"=>$name,"email"=>$email));
or You can also use this :
$data = array("id"=>$uid,"name"=>$name,"email"=>$email); DB::table('users')->insert($data);