-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Description
Given something like:
$api->resource('foo')
->relationships(static function (RelationshipsRegistration $relations) {
$relations->hasOne('bar');
$relations->hasOne('fizz');
$relations->hasMany('buzz');
})
->middleware('example');How can I specify a middleware for the buzz relationship independent of bar and fizz (and the main resource)? Something akin to this is what I'm looking to do:
$api->resource('foo')
->relationships(static function (RelationshipsRegistration $relations) {
$relations->hasOne('bar');
$relations->hasOne('fizz')->middleware('cache.headers:public;max_age=604800');
$relations->hasMany('buzz');
})
->middleware('cache.headers:public;max_age=600');On that same topic, is there a way to setup different middleware per resource endpoint? I'd like to be able to target the index separately from the individual item. I have a workaround where I split out the resource into multiple definitions using ->only('index') but it seems clunky.
Metadata
Metadata
Assignees
Labels
No labels