Académique Documents
Professionnel Documents
Culture Documents
DB_CONNECTION=mysql DB_CONNECTION=mysql
DB_HOST=127.0.0.1 DB_HOST=127.0.0.1
DB_PORT=3306 DB_PORT=3306
DB_DATABASE=homestead DB_DATABASE=haranahtours
DB_USERNAME=homestead DB_USERNAME=root
DB_PASSWORD=secret DB_PASSWORD=null
Step 3: Go to config database.php
foreach($variablename as $newname) {
#code
}
Example:
Column Name
Query Select
Equivalent: SELECT columnone, columntwo FROM ‘tablename’
Code:
$variablename = DB::table(‘tablename’)
->select(‘columnone’, ‘columntwo’)->get();
Query Where
Equivalent: SELECT * FROM ‘tablename’ WHERE column_name = ‘condition’
Code:
$variablename = DB::table(‘tablename’)->where([
[‘column_one’, ‘=’, ‘condition’],
[‘column_two’, ‘>’, ‘value’]
]);
$variablename = DB::table(‘tablename’)
->select(‘column_name’)
->distinct()
->where(‘column_one’, ‘condition’)
->groupBy(‘column_name’)
->orderBy(‘column_name’, ‘asc’)
->skip(10)
->take(5)
->get();
Query Join
Equivalent: SELECT * FROM ‘table_one’ JOIN ‘table_tow’ USING (‘column_id’)
Code:
$variablename = DB::table(‘table_one’)
->join(‘table_two’, ‘table_one.id’, ‘=’, ‘table_two.id’)
->get();
Query Insert
Equivalent: ISNERT INTO tablename (column_one, column_two) VALUES (‘value_one’,
‘value_two’)
Code:
DB::table(‘tablename’)->insert([
[‘column_one’ => ’value_one’, ‘column_two’ => ‘value_two’]
]);
Query Update
A “View” is a page in the website. This is where you construct your website.
You can access it with the use of ROUTING (explained on next page)
Routing (Reference: https://laravel.com/docs/5.5/routing)
WHAT IS ROUTING?
Routing is used to redirect pages. You may also use it for you HTTP methods
Go to haranahtours routes
web.php
Route::view(‘/uri_path’, ‘folder.page_name.blade.php’,
[‘variablename’ => ‘variabe_value’]);
Example:
web.php
management.blade.php
http://localhost/haranahtours/public/management/2