Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  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. //Route::get('/', function () {
  15.   //  return view('pages.home');
  16. //});
  17.  
  18. Route::get('/', function () {
  19.     return view('chap5.home');
  20. });
  21.  
  22. Route::get('about', function () {
  23.     $halaman='about';
  24.     return view('chap5.about',compact('halaman'));
  25. });
  26.  
  27. /*Route::get('karyawan', function () {
  28.     $halaman='karyawan';
  29.     $karyawan=['Munawar', 'Budi Santoso', 'Widya Ningrum', 'Unggul Jaya'];
  30.     return view('chap5.karyawan',compact('halaman','karyawan'));
  31. });*/
  32.  
  33. //Route::get('about', 'BelajarController@index');
  34. //Route::get('karyawan/create','KaryawanController@index');
  35. //Route::post('karyawan','KaryawanController@store');
  36.  
  37. Route::group(['middleware'=>['web']],function(){
  38.     Route::get('karyawan','KaryawanController@index');
  39.     Route::get('karyawan/create','KaryawanController@create');
  40.     Route::get('karyawan/{karyawan}', 'KaryawanController@show');
  41.     Route::post('karyawan','KaryawanController@store');
  42.     Route::get('karyawan/{karyawan}/edit', 'KaryawanController@edit');
  43.     Route::patch('karyawan/{karyawan}', 'KaryawanController@update');
  44.     Route::delete('karyawan/{karyawan}', 'KaryawanController@destroy');
  45.     Route::get('caridata','KaryawanController@search');
  46. });
  47.  
  48.  
  49. Route::get('sampeldata',function(){
  50.     DB::table('employees')->insert([
  51.     [
  52.     'nama' => 'Zaid',
  53.     'nip' => '10001',
  54.     'tgl_lahir' => '1990-01-22',
  55.     'gender' => 'L',
  56.     'created_at' => '2017-04-24 21:18',
  57.     'updated_at' => '2017-04-24 21:18'
  58.     ],
  59.     [
  60.     'nama' => 'Hindun',
  61.     'nip' => '10002',
  62.     'tgl_lahir' => '1988-01-22',
  63.     'gender' => 'P',
  64.     'created_at' => '2017-04-24 21:19',
  65.     'updated_at' => '2017-04-24 21:19'
  66.     ],
  67.     [
  68.     'nama' => 'Hasan',
  69.     'nip' => '10003',
  70.     'tgl_lahir' => '1991-11-26',
  71.     'gender' => 'L',
  72.     'created_at' => '2017-04-24 21:18',
  73.     'updated_at' => '2017-04-24 21:18'
  74.     ],
  75.     ]);
  76. });