I created a new model "CategoryStatus" in my application.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class CategoryStatus extends Model
{
use SoftDeletes;
protected $table = 'category_status';
public $timestamps = true;
protected $dates = ['deleted_at'];
protected $fillable = ['status', 'category_id', 'user_id'];
public function category()
{
return $this->belongsTo('App\Models\Category');
}
}
I try to access my model like this:
CategoryStatus::where('id', $id)->first()
But every time I receive an error with the CORS policy (when I make an axios call with views). I installed the `spatie' extension which works from the beginning.
Access to XMLHttpRequest at 'http://myapp.test/api/bilan' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 14:00:22.815
When I do my query with DB::
it works
I'm pretty sure it's not a CORS problem. Can you tell me why ?
Thank you