From d25c6c6b028bd08aef7324de00cf359880e2746b Mon Sep 17 00:00:00 2001 From: czup Date: Sat, 4 Jan 2020 22:04:28 +0100 Subject: [PATCH] =?UTF-8?q?Mo=C5=BCliwo=C5=9Bc=20zmiany=20nazwy=20szkole?= =?UTF-8?q?=C5=84/bada=C5=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/trainingsController.php | 29 +++++++++ resources/views/trainings.blade.php | 62 ++++++++++++++++--- .../views/trainingsAddFireFighters.blade.php | 6 +- routes/web.php | 1 + 4 files changed, 86 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/trainingsController.php b/app/Http/Controllers/trainingsController.php index 4a80175..62354a1 100644 --- a/app/Http/Controllers/trainingsController.php +++ b/app/Http/Controllers/trainingsController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\equipment; use App\trainings; use App\trainingsFirefighters; use Illuminate\Http\Request; @@ -34,6 +35,24 @@ class trainingsController extends Controller } } + public function store(){ + $this->validate(request(), [ + 'name' => 'required', + ], + [ + 'required' => ':attribute jest wymagany(a).', + ]); + + + $request = request(); + $equipment = trainings::create([ + 'fireStationID' => auth()->user()->fireStationID, + 'trainingName' => $request-> name, + ]); + + return redirect()->to('/szkolenia'); + } + public function addForm(){ } @@ -143,4 +162,14 @@ class trainingsController extends Controller return redirect()->to('/szkolenia'); } + + public function trainingsRename(Request $request){ + $validator = Validator::make($request->all(), [ + 'trainingID' => 'required', + 'trainingName' => 'required', + ]); + + trainings::where('id', '=', $request->trainingID) + ->update(['trainingName' => $request->trainingName]); + } } diff --git a/resources/views/trainings.blade.php b/resources/views/trainings.blade.php index 89ea4d4..210e23a 100644 --- a/resources/views/trainings.blade.php +++ b/resources/views/trainings.blade.php @@ -1,6 +1,11 @@ @extends('layout.app') - +Add Edit Delete Table Row Example using JQuery - ItSolutionStuff.com + + + + + @section('left-menu') @parent