alat perang laravel php
#aneka route
Route::get('/','StudentController@index')->name('home');
Route::get('create','StudentController@create')->name('create');
Route::post('create','StudentController@store')->name('store');
Route::get('edit/{id}', 'StudentController@edit')->name('edit');
Route::post('update/{id}','StudentController@update')->name('update');
Route::delete('delete/{id}','StudentController@delete')->name('delete');
Route::resource('user', 'UserController');
Route::group(['prefix' => 'product'], function() {
Route::get('/', 'ProductController@index');
Route::get('/new', 'ProductController@create');
Route::post('/', 'ProductController@save');
Route::get('/{id}', 'ProductController@edit');
Route::put('/{id}', 'ProductController@update');
Route::delete('/{id}', 'ProductController@destroy');
});
Route::group(['middleware'=>'auth'], function(){
Route::get('blog', 'BlogController@index');
Route::get('kontak', 'BlogController@kontak');
Route::get('profil', 'BlogController@profil');
#Membuat database
php artisan make:migration create_users_table
php artisan migrate
#setting app dbnya (eloquent model)
php artisan make:model Flight
php artisan make:model Flight --migration
php artisan make:model Flight -m
protected $fillable = [
'name', 'email', 'password',
];
protected $table = 'my_flights';
protected $table = 'blog';
public $timestamps = false;
protected $guarded =[];
ini tanpa syarat modelnya
Controller
php artisan make:controller namacontroller --resource (route bersifat crud langsung)
cth :
php artisan make:controller UserController --resource
Route::resource('user', 'UserController');
php artisan make:controller [nama_controller]
php artisan route list
membuat tabel
php artisan make:migration create_pages_table — create=pages
menambah tabel field
php artisan make:migration add_user_id_field_to_pages_table — table=pages
or
php artisan make:migration add_user_id_field_to_pages