mardi 27 décembre 2022

How do I pass a method with my own constraints in a controller that uses request pattern to display data

Merry Christmass team! I have a problem trying to figure out how to pass a method with my own constraints in a controller that is bound to request patter paradigm:

Sample Controller Code:

class SampleController
{
    protected $model = SampleModel::class;
    protected $indexRequest = IndexRequest::class;
 
}

Request Class

class IndexRequest extends FormRequest
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */

    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [];
    }

Assume I have a method that I want to do something different.Say I want to fetch some data based on some column constraints. Whats the approach?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire