added to the after action report controller

This commit is contained in:
2021-03-12 00:28:12 +09:00
parent aae582344e
commit adadd7994e
3 changed files with 30 additions and 3 deletions

View File

@@ -23,7 +23,6 @@ class AfterActionReportsController extends Controller
public function StoreReport(Request $request) { public function StoreReport(Request $request) {
$this->validate($request, [ $this->validate($request, [
'fc' => 'required',
'location' => 'required', 'location' => 'required',
'time' => 'required', 'time' => 'required',
'comms' => 'required', 'comms' => 'required',
@@ -35,17 +34,43 @@ class AfterActionReportsController extends Controller
'well' => 'required', 'well' => 'required',
'comments' => 'required', 'comments' => 'required',
]); ]);
$report = new Report;
$report->fc_id = auth()->user()->getId();
$report->fc_name = auth()->user()->getName();
$report->formup_time = $request->time;
$report->formup_location = $request->location;
$report->comms = $request->comms;
$report->doctrine = $request->doctrine;
$report->objective = $request->objective;
$report->objective_result = $request->result;
$report->summary = $request->summary;
$report->improvements = $request->improvements;
$report->worked_well = $request->well;
$report->additon_comments = $request->comments;
$report->save();
return redirect('/reports/display/all')->with('success', 'Added report to the database.');
} }
public function StoreComment(Request $request) { public function StoreComment(Request $request) {
$this->validate($request, [ $this->validate($request, [
'report_id' => 'required',
'comments' => 'required',
]); ]);
$comment = new AfterActionReportComment;
$comment->report_id = $request->report_id;
$comment->character_id = auth()->user()->getId();
$comment->character_name = auth()->user()->getName();
$comment->comments = $required->comments;
$comment->save();
return redirect('/reports/display/all')->with('success', 'Added comemnt to the report.');
} }
public function DisplayAllReports() { public function DisplayAllReports() {
return view('reports.user.displayreports'); return view('reports.user.displayreports');
} }

View File

@@ -23,6 +23,7 @@ class AfterActionReport extends Model
protected $fillable = [ protected $fillable = [
'fc_id', 'fc_id',
'fc_name', 'fc_name',
'formup_time',
'formup_location', 'formup_location',
'comms', 'comms',
'doctrine', 'doctrine',

View File

@@ -18,6 +18,7 @@ class CreateAfterActionReportsTables extends Migration
$table->id(); $table->id();
$table->unsignedBigInteger('fc_id'); $table->unsignedBigInteger('fc_id');
$table->string('fc_name'); $table->string('fc_name');
$table->dateTime('formup_time');
$table->string('formup_location'); $table->string('formup_location');
$table->enum('comms', [ $table->enum('comms', [
'W4RP', 'W4RP',