Advertisement
muza_sm183

web.php (Routes)

May 28th, 2017
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.92 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. |--------------------------------------------------------------------------
  5. | Web Routes
  6. |--------------------------------------------------------------------------
  7. |
  8. | Here is where you can register web routes for your application. These
  9. | routes are loaded by the RouteServiceProvider within a group which
  10. | contains the "web" middleware group. Now create something great!
  11. |
  12. */
  13. /*--------------------------------------------------------------*/
  14.  
  15. Route::get('/',function() {
  16.     return view('chap5.home');
  17. });
  18. route::get('about', function () {
  19.     return view('chap5.about', compact('halaman'));
  20. });
  21.  
  22. /*Route::get('karyawan',function(){
  23.     $halaman='karyawan';
  24.     $karyawan=['Munawar','Budi Santoso','Widya Ningrum','Unggul Jaya'];
  25.     return view('chap5.karyawan',compact('halaman','karyawan'));
  26. })*/
  27.  
  28. Route::group(['middleware'=>['web']],function(){
  29.     Route::get('karyawan','KaryawanController@index');
  30.     Route::get('karyawan/create','KaryawanController@create');
  31.     Route::get('karyawan/{karyawan}', 'KaryawanController@show');
  32.     Route::post('karyawan','KaryawanController@store');
  33.     Route::get('karyawan/{karyawan}/edit','KaryawanController@edit');
  34.     Route::patch('karyawan/{karyawan}','KaryawanController@update');
  35.     Route::delete('karyawan/{karyawan}','KaryawanController@destroy');
  36.     Route::get('caridata','KaryawanController@search');
  37. });
  38. Route::get('sampeldata',function(){
  39.     DB::table('employees')->insert([
  40.         [
  41.         'nama'  =>'Zaid',
  42.         'nip'   =>'10001',
  43.         'tgl_lahir' =>'1990-01-22',
  44.         'gender'    =>'L',
  45.         'created_at'    =>'2017-04-24
  46.         21:18',
  47.         'updated_at'=>'2017-04-24 21:18'],
  48.         [
  49.         'nama'  =>'Hindun',
  50.         'nip'   =>'10002',
  51.         'tgl_lahir'=>'1998-01-22',
  52.         'gender'=>'P',
  53.         'created_at'=>'2017-04-24 21:19',
  54.         'updated_at'=>'2017-04-24 21:19'],
  55.         [
  56.         'nama'=>'Hasan',
  57.         'nip'=>'10003',
  58.         'tgl_lahir'=>'1991-11-26',
  59.         'gender'=>'L',
  60.         'created_at'=>'2017-04-24 21:18',
  61.         'updated_at'=>'2017-04-24 21:18'],
  62.         ]);
  63. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement