SHARE
TWEET

nelayancontroller.php

a guest Oct 22nd, 2017 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. namespace App\Http\Controllers;
  4.  
  5. use Illuminate\Http\Request;
  6.  
  7. use App\Http\Requests;
  8. use App\Nelayan;
  9. use App\Ahliwaris;
  10. use App\Kub;
  11.  
  12. class NelayanController extends Controller
  13. {
  14.     public function __construct()
  15.     {
  16.         $this->middleware('auth');
  17.     }
  18.    
  19.     /**
  20.      * Display a listing of the resource.
  21.      *
  22.      * @return \Illuminate\Http\Response
  23.      */
  24.     public function index()
  25.     {
  26.         $datanelayan = Nelayan::all();
  27.         $datanelayan ->load('ahli_waris');
  28.         $datanelayan ->load('kub');
  29.         return view('nelayan.index', compact('datanelayan'));
  30.     }
  31.  
  32.     /**
  33.      * Show the form for creating a new resource.
  34.      *
  35.      * @return \Illuminate\Http\Response
  36.      */
  37.     public function create()
  38.     {
  39.         $data_kub = Kub::all();
  40.         $data_waris = ahliwaris::all();
  41.         return view('nelayan.create', compact('data_kub', 'data_waris'));
  42.     }
  43.  
  44.     /**
  45.      * Store a newly created resource in storage.
  46.      *
  47.      * @param  \Illuminate\Http\Request  $request
  48.      * @return \Illuminate\Http\Response
  49.      */
  50.     public function store(Request $request, Nelayan $nelayan)
  51.     {
  52.         $nelayan->create($request->all());
  53.         return back();
  54.     }
  55.  
  56.     /**
  57.      * Display the specified resource.
  58.      *
  59.      * @param  int  $id
  60.      * @return \Illuminate\Http\Response
  61.      */
  62.     public function show(Nelayan $nelayan)
  63.     {
  64.         $nelayan->report($request->all());
  65.         return back();
  66.         return view('nelayan.show', compact('nelayan'));
  67.     }
  68.  
  69.     /**
  70.      * Show the form for editing the specified resource.
  71.      *
  72.      * @param  int  $id
  73.      * @return \Illuminate\Http\Response
  74.      */
  75.     public function edit(Nelayan $nelayan)
  76.     {
  77.         $datanelayan = Nelayan::all();
  78.         return view('nelayan.edit', compact('nelayan','ahli_waris', 'kub'));
  79.     }
  80.  
  81.     /**
  82.      * Update the specified resource in storage.
  83.      *
  84.      * @param  \Illuminate\Http\Request  $request
  85.      * @param  int  $id
  86.      * @return \Illuminate\Http\Response
  87.      */
  88.     public function update(Request $request, Nelayan $nelayan)
  89.     {
  90.         $nelayan->update($request->all());
  91.         return back();
  92.     }
  93.  
  94.     /**
  95.      * Remove the specified resource from storage.
  96.      *
  97.      * @param  int  $id
  98.      * @return \Illuminate\Http\Response
  99.      */
  100.     public function destroy(Nelayan $nelayan)
  101.     {
  102.         $nelayan->delete();
  103.         return back();
  104.     }
  105.  
  106.      public function report()
  107.     {
  108.         $datanelayan = Nelayan::all();
  109.         return view('nelayan.report', compact('datanelayan' ));
  110.     }
  111. }
RAW Paste Data
Top