We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 8 | class DonorController extends Controller |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Display a listing of the resource. |
||
| 12 | * |
||
| 13 | * @return \Illuminate\Http\Response |
||
| 14 | */ |
||
| 15 | public function index() |
||
| 16 | { |
||
| 17 | $donors = Donor::orderBy('id', 'desc')->get(); |
||
| 18 | |||
| 19 | return view('donors.index', compact('donors')); |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Show the form for creating a new resource. |
||
| 24 | * |
||
| 25 | * @return \Illuminate\Http\Response |
||
| 26 | */ |
||
| 27 | public function create() |
||
| 28 | { |
||
| 29 | return view('donors.create'); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Store a newly created resource in storage. |
||
| 34 | * |
||
| 35 | * @param \Illuminate\Http\Request $request |
||
| 36 | * |
||
| 37 | * @return \Illuminate\Http\Response |
||
| 38 | */ |
||
| 39 | public function store(Request $request) |
||
| 40 | { |
||
| 41 | $this->validate( |
||
| 42 | $request, |
||
| 43 | [ |
||
| 44 | 'user_id' => 'required', |
||
| 45 | 'blood_type_id' => 'required', |
||
| 46 | ] |
||
| 47 | ); |
||
| 48 | |||
| 49 | $donor = new Donor(); |
||
| 50 | $donor->user_id => $request['user_id']; |
||
|
|
|||
| 51 | $donor->blood_type_id => $request['blood_type_id']; |
||
| 52 | $donor->save(); |
||
| 53 | |||
| 54 | return redirect()->route('user.profile'); |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Display the specified resource. |
||
| 59 | * |
||
| 60 | * @param int $id |
||
| 61 | * |
||
| 62 | * @return \Illuminate\Http\Response |
||
| 63 | */ |
||
| 64 | public function show($id) |
||
| 65 | { |
||
| 66 | $donor = Donor::find($id); |
||
| 67 | |||
| 68 | return view('donors.Show', compact('donor')); |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Show the form for editing the specified resource. |
||
| 73 | * |
||
| 74 | * @param int $id |
||
| 75 | * |
||
| 76 | * @return \Illuminate\Http\Response |
||
| 77 | */ |
||
| 78 | public function edit($id) |
||
| 79 | { |
||
| 80 | return view('donors.edit'); |
||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * Update the specified resource in storage. |
||
| 85 | * |
||
| 86 | * @param \Illuminate\Http\Request $request |
||
| 87 | * @param int $id |
||
| 88 | * |
||
| 113 |