Category Archives: laravel
Laravel where not between
DB::table(‘table_name’)->whereNotBetween(‘column_name’,[value1,value2])->get(); is used for where NotBetween condition in laravel.
Laravel where Not Between clause Example
We are going to fetch data with whereNotBetween clause in laravel from the table emp.
DB::table('emp')->whereNotBetween('salary',[10000,20000])->get();
Will Generate the following query.
//Select * from emp where salary NOT BETWEEN 10000 AND 20000 ;
Laravel where between
DB::table(‘table_name’)->whereBetween(‘column_name’,[value1,value2])->get(); is used for where Between condition in laravel.
Laravel where Between clause Example
We are going to fetch data with whereBetween clause in laravel from the table emp.
DB::table('emp')->whereBetween('salary',[10000,20000])->get();
Will Generate the following query.
//Select * from emp where salary BETWEEN 10000 AND 20000 ;
Laravel or where
DB::table(‘table_name’)->where(‘column_name’, ‘condition’, value)->orWhere(‘column_name’,’condition’,value)->get(); is used for orWhere condition in laravel.
Laravel or where clause Example
We are going to fetch data with where clause in laravel from the table emp.
DB::table('emp')->where('salary', '=',10000)->orWhere('experience' = '1')->get();
Will Generate the following query.
//Select * from emp where salary = ‘10000’ or experience = ‘1’ ;
Laravel where clause
DB::table(‘table_name’)->where(‘column_name’, ‘contional_operator’, value)->get(); is used for where condition in laravel.
Laravel where clause Example 1
We are going to fetch data with where clause in laravel from the table emp.
DB::table('emp')->where('salary', '=',10000)->get();
Will Generate the following query.
//Select * from emp where salary = ‘10000’;
Laravel where clause Example 2
DB::table('emp')->where('salary', '<',10000)->get();
Will Generate the following query.
//Select * from emp where salary < '10000';
Laravel truncate table
DB::table(‘table_name’)->truncate(); is used to truncate table in laravel.
Laravel truncate table example
Below is the simple example for Laravel truncate table
DB::table('users')->tuncate();
Will truncate the users table.
Laravel delete all records from table
DB::table(‘table_name’)->delete(); is used to delete All records from table in laravel.
Syntax : Laravel delete all records from table example
Below is the simple example for Laravel delete all records from table
DB::table('users')->delete();
Will delete all records from table.
Laravel delete query example
DB::table(‘table_name’)->where(‘column_name’, ‘=’, value)->delete(); is used to delete records from table in laravel.
Laravel delete query example with Syntax
Below is the simple Laravel Delete query Example
DB::table('users')->where('id', '=', 66)->delete();
Will delete the record where id is 66.
Laravel join query example
DB::table(‘table_name’)->join(‘condition’)->select(‘column_names’)->get(); is used for join in laravel.
Laravel join query example
DB::table('users') ->join('city','city.user_id','=','users.id') ->select('users.name','city.city_name') ->get();
Install laravel 5 on windows Xampp or Wamp
Install laravel 5 on windows Xampp or Wamp It is very simple to install laravel On windows Xampp. Here in this tutorial we are going to explain how you can install Laravel 5 on windows.
Steps to Install laravel 5 on windows Xampp or Wamp
You can install laravel 5 on windows by following the steps given below –
1. First you need to Download laravel 5 from https://github.com/laravel/laravel
2. After completion of download Unzip it in folder[xampp\htdocs\laravel or wampp\www\laravel] named as : laravel Which Will Look Like
3.Now download Composer-Setup.exe from https://getcomposer.org/download/ And Install it.
4. After Successful installation of composer right click on laravel folder go to > Use Composer Here . When You click on it a terminal will be opened. Type the below command :
Command to Install Laravel 5.4
composer create-project --prefer-dist laravel/laravel test-laravel-5-project
Command to Install Laravel Lower Versio(< 5.4)
If you want to install lower version run the below command-
composer create-project laravel/laravel test-laravel-5-project –prefer-dist
5. Wait For a minute while your project is being installed……
6.After Successful installation you will see successful message at the end of terminal.
7. Now You can access your first project as :
http://localhost/laravel/test-laravel-5-project/public/
Which will look like with welcome page.