tailflow / laravel-orion

The simplest way to create REST API with Laravel

Home Page:https://orion.tailflow.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

including "*" doesn't fail, yet also doesn't include relations

ldiebold opened this issue · comments

We're trying to do some quick prototyping and want to whitelist all relationships.

A request for data works with the following, however the relationship is not loaded:

<?php

namespace App\Http\Controllers\Api;

use App\Models\Tank;
use Orion\Http\Controllers\Controller;

class TankController extends Controller
{
    protected $model = Tank::class;

    public function includes(): array
    {
        return ['*'];
    }
}

Request looks like this:

http://localhost/api/tanks?include=org

And if I do the following, everything works as expected (org is loaded in the response):

<?php

namespace App\Http\Controllers\Api;

use App\Models\Tank;
use Orion\Http\Controllers\Controller;

class TankController extends Controller
{
    protected $model = Tank::class;

    public function includes(): array
    {
        return ['org'];
    }
}

Let me know if you need any more information, or a reproduction!

Hi @ldiebold,

Thank you for reporting the issue - I will look into it.