class Mark extends Model
...
public function tmprel()
{
return $this->belongsTo(TestList::class, 'id', 'test_list_id');
}
...
}
namespace App\Entity\Vehicle;
use App\Entity\mark\MarkComment;
use Illuminate\Database\Eloquent\Model;
class Mark extends Model
{
public function editions()
{
return $this->hasMany(Edition::class);
// return $this->hasMany(Edition::class, 'mark_id')
// return $this->hasMany(Edition::class, 'mark_id', 'id');
}
}
dd($mark->editions)
$editions = $mark->editions()->orderBy('sort')->get();
namespace App\Entity\Vehicle;
use App\Entity\Behaviors\ImagePublicBehavior;
use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\Notifiable;
class Mark extends Model
{
....
$mark->comments()->create(['body' => 'xxx', 'user_id' => 1]);
dd($mark->comments);
dd($mark->comments());
dd($mark->comments()->get());
<p>{{order.someParam}}</p>