fix map-info-box display (#1104)
* fix map-info-box display * Check user on PIREP show/edit/update/submit * add missing use * refactoring according to comments; use UpdatePirepRequest for authorization and make user available to view Co-authored-by: Andreas Palm <ap@ewsp.de> Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
This commit is contained in:
@@ -5,10 +5,20 @@ namespace App\Http\Requests;
|
||||
use App\Contracts\FormRequest;
|
||||
use App\Models\Pirep;
|
||||
use App\Repositories\PirepFieldRepository;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpdatePirepRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Is the user allowed to do this?
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
$pirep = Pirep::findOrFail($this->route('id'), ['user_id']);
|
||||
return $pirep->user_id === Auth::id();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user