Error
Class ' App\Models\Tests\test' not found
Используется laravel 8.
User model:
<?php
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
public function createdTests()
{
return $this->hasMany(' App\Models\Tests\test', 'creator_id', 'id');
}
}
test:
namespace App\Models\Tests;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\Tests\testViews;
use App\ILanguages;
class test extends Model
{
public function creator()
{
return $this->belongsTo('App\Models\User', 'creator_id', 'id');
}
Controller:
auth()->user()->createdTests()->create([
'name' => "hello",
'desc' => "hello",
]);