{{ $errors->first('name') }}
diff --git a/app/Database/migrations/2022_01_10_131604_update_awards_add_active.php b/app/Database/migrations/2022_01_10_131604_update_awards_add_active.php new file mode 100644 index 00000000..8d8baf9f --- /dev/null +++ b/app/Database/migrations/2022_01_10_131604_update_awards_add_active.php @@ -0,0 +1,15 @@ +boolean('active')->default(true)->nullable()->after('ref_model_params'); + }); + } +} diff --git a/app/Listeners/AwardHandler.php b/app/Listeners/AwardHandler.php index 52463acf..0e74419e 100644 --- a/app/Listeners/AwardHandler.php +++ b/app/Listeners/AwardHandler.php @@ -60,7 +60,7 @@ class AwardHandler extends Listener */ public function checkForAwards($user) { - $awards = Award::all(); + $awards = Award::where('active', 1)->get(); foreach ($awards as $award) { $klass = $award->getReference($award, $user); if ($klass) { diff --git a/app/Models/Award.php b/app/Models/Award.php index 632ba861..e501fb98 100755 --- a/app/Models/Award.php +++ b/app/Models/Award.php @@ -21,6 +21,7 @@ class Award extends Model 'image_url', 'ref_model', 'ref_model_params', + 'active', ]; public static $rules = [ @@ -29,6 +30,7 @@ class Award extends Model 'image_url' => 'nullable', 'ref_model' => 'required', 'ref_model_params' => 'nullable', + 'active' => 'nullable', ]; /** diff --git a/resources/views/admin/awards/edit.blade.php b/resources/views/admin/awards/edit.blade.php index ba39366b..c27eb54a 100755 --- a/resources/views/admin/awards/edit.blade.php +++ b/resources/views/admin/awards/edit.blade.php @@ -1,5 +1,5 @@ @extends('admin.app') -@section('title', "Edit \"$award->title\" Award") +@section('title', "Edit \"$award->name\" Award") @section('content')
{{ $errors->first('name') }}
{{ $errors->first('image_url') }}
{{ $errors->first('ref_model') }}
{{ $errors->first('ref_model_params') }}
- -- -
+Name | -Description | -Image | -Action | +Name | +Description | +Image | +Active | +Action | - @foreach($awards as $award) -
---|---|---|---|---|
- - {{ $award->name }} - | -{{ $award->description }} | -- - @if($award->image_url) - - @else - - - @endif - | -- {{ Form::open(['route' => ['admin.awards.destroy', $award->id], 'method' => 'delete']) }} - - - - {{ Form::button('', [ - 'type' => 'submit', - 'class' => 'btn btn-sm btn-danger btn-icon', - 'onclick' => "return confirm('Are you sure you want to delete this award?')" - ]) }} - - {{ Form::close() }} - | -|
+ {{ $award->name }} + | ++ {{ $award->description }} + | ++ @if($award->image_url) + + @else + - + @endif + | ++ @if($award->active) + + @else + + @endif + | ++ {{ Form::open(['route' => ['admin.awards.destroy', $award->id], 'method' => 'delete']) }} + + + + {{ Form::button('', [ + 'type' => 'submit', + 'class' => 'btn btn-sm btn-danger btn-icon', + 'onclick' => "return confirm('Are you sure you want to delete this award?')" + ]) }} + {{ Form::close() }} + | +