Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. eMaintenance Note:
  2. -------------------
  3.  
  4. 1. Template
  5. @yield('kandungan')
  6.  
  7. Content
  8. @section('kandungan')
  9. ....
  10. @endsection
  11.  
  12. Assets letak dlm folder public
  13.  
  14. Root directory for folder public is /
  15. So semua link to CSS dan JS, bermula dengan /
  16.  
  17. 2. Kalau dapat error 404, something tak tally di route/web.php
  18.  
  19. 3. Pecahkan source code kepada bahagian2 kecil dengan menggunakan
  20. @include('folder.file')
  21. Tak perlu tulis file.blade.php
  22.  
  23. 4. Create module Solusi
  24. >> php artisan make:model Solution -mcr
  25.  
  26. PS: >> adalah tanda yang bermaksud, taip di command line (command prompt)
  27.  
  28. Cipta table melalui dua cara:
  29. 1. Direct di phpmyadmin
  30.  
  31. 2. Migrate
  32. edit file migration
  33. [database] -> [migrations] -> namafile.php
  34. perform migration
  35. >> php artisan migrate
  36.  
  37. ref: https://laravel.com/docs/6.x/migrations#creating-columns
  38.  
  39. 3. Kalau pakai softdelete di migration, make sure apply di modelnya as well
  40.  
  41. use SoftDeletes;
  42.  
  43. ref: https://laravel.com/docs/6.x/eloquent#soft-deleting
  44.  
  45.  
  46. 4. Edit route untuk design URL bagi modul Solusi
  47. [routes] -> web.php
  48.  
  49. 5. Edit controller
  50. :: index
  51. $solutions = Solution::all();
  52.  
  53. 6. Create seeder utk automatically push record into table solutions
  54. setiap kali ia di migrate
  55.  
  56. >> php artisan make:seeder SolutionsTableSeeder
  57.  
  58. nota: command php artisan tidak boleh dijalankan sekiranya
  59. ada error di mana2 source code.
  60.  
  61. edit SolutionsTableSeeder.php
  62. [database] -> [seeds]
  63.  
  64. update entry di atas dlm file
  65. [database] -> [seeds] -> DatabaseSeeder.php
  66.  
  67. run seeder
  68. >> php artisan db:seed
  69. >> php artisan migrate --seed
  70. >> php artisan migrate:refresh --seed
  71.  
  72. 7. Create view
  73. jangan lupa ada @csrf utk form
  74.  
  75. 8. Test form
  76. di function store
  77. return $request->all();
  78.  
  79. 9. Buat validation
  80. >> php artisan make:request SolutionRequest
  81. Authorize --> true
  82.  
  83. set rule apa yang patut
  84.  
  85. implement SolutionRequest pada function store dan update
  86.  
  87. ref: https://laravel.com/docs/6.x/validation#available-validation-rules
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement