laravel
laravel copied to clipboard
JSON:API for Laravel applications
For a while now I have been working around adding global scope to Proxy models since I managed to apply filters and other scheme methods that allowed me to filter...
I'm currently working on a project where I use the following libaries: - https://laraveljsonapi.io/docs/2.0/getting-started/ - https://github.com/jenssegers/laravel-mongodb - https://github.com/ImanRJB/laravel-mongodb It is only regarding, POST and PATCH not GET. All the relations...
Is there an easier way of me accessing the Store from within my custom readingRelatedx method without overriding the showRelated method in the controller and passing it in like this;...
Hi, I have "virtual" relationship declared as: ```php public function relationships($request): iterable { return [ ...iterator_to_array(parent::relationships($request)), $this->relation('currentCouple')->withData(fn (Patient $patient) => $patient->getCurrentCouple()), ]; } ``` in my resource class. It's works...
For example, for cursor pagination that uses resource IDs we need some rule objects that use the Laravel JSON:API implementation to validate those IDs. I.e. we have the ID pattern...
I'm trying create JSON APIs for a model which has a polymorphic `morphTo` relationship. I created the relationship following the documentation (in particular the section on `morphTo` present in [this](https://laraveljsonapi.io/docs/2.0/schemas/relationships.html#morph-to)...
Many of you may have noticed I haven't been doing a lot of work on this project recently since v3 (Laravel 10) dropped earlier this year. To explain, open source...
Hi, I'm following the docs https://laraveljsonapi.io/docs/3.0/digging-deeper/countable.html about countable relationships but seems to not having any results from it. I have a complete set of json-api working in production so Im...
I have a problem in the following case and with eager loading: two fields with the same type: HasOne::make('metric')->type('inventory-metrics'), HasOne::make('metric-service', 'metricService')->type('inventory-metrics'), in model: public function metric(): HasOne { return $this->hasOne(Metric::class,...
How do I create a custom attribute in a schema that results from the SUM function? For instance, there's a `products` table with a has-many relationship to `product_prices` and a...