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) {
$this->validate($request, [
'fc' => 'required',
'location' => 'required',
'time' => 'required',
'comms' => 'required',
@@ -36,12 +35,38 @@ class AfterActionReportsController extends Controller
'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) {
$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() {

View File

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

View File

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