2023-06-20 11:55:52 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Policies;
|
|
|
|
|
|
|
|
|
|
use App\Models\Question;
|
|
|
|
|
use App\Models\Service;
|
2023-06-20 17:37:15 +02:00
|
|
|
use App\Policies\Rules\UserStaticRules as USR;
|
2023-06-20 11:55:52 +02:00
|
|
|
|
|
|
|
|
class QuestionPolicy
|
|
|
|
|
{
|
2023-06-20 17:37:15 +02:00
|
|
|
/**
|
|
|
|
|
* View a Question.
|
|
|
|
|
*
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
public function view(): bool
|
|
|
|
|
{
|
|
|
|
|
return USR::everyOne();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2023-09-06 17:24:53 +02:00
|
|
|
* ViewAny a Question.
|
|
|
|
|
*
|
2023-06-20 17:37:15 +02:00
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
public function viewAny(): bool
|
|
|
|
|
{
|
|
|
|
|
return USR::everyOne();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a Question.
|
|
|
|
|
*
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
public function create(): bool
|
|
|
|
|
{
|
|
|
|
|
return USR::everyOne();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update a Question.
|
|
|
|
|
*
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
public function update(): bool
|
|
|
|
|
{
|
|
|
|
|
return USR::everyOne();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Delete a Question.
|
|
|
|
|
*
|
|
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
public function delete(): bool
|
|
|
|
|
{
|
|
|
|
|
return USR::everyOne();
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-20 11:55:52 +02:00
|
|
|
/**
|
2023-09-06 17:24:53 +02:00
|
|
|
* Check if the question belongs to the service.
|
2023-06-20 11:55:52 +02:00
|
|
|
*
|
2023-06-23 17:18:59 +02:00
|
|
|
* @param \App\Models\Service $service
|
|
|
|
|
* @param \App\Models\Question $question
|
2023-06-20 11:55:52 +02:00
|
|
|
* @return boolean
|
|
|
|
|
*/
|
|
|
|
|
public function questionBelongsToService(Service $service, Question $question)
|
|
|
|
|
{
|
|
|
|
|
return $service->brand->id === $question->brand_id;
|
|
|
|
|
}
|
|
|
|
|
}
|