laravel has one through
<?php namespace App; use Illuminate\Database\Eloquent\Model; class Mechanic extends Model { /** * Get the car's owner. */ public function carOwner() { return $this->hasOneThrough('App\Owner', 'App\Car'); } }
laravel has one through
<?php namespace App; use Illuminate\Database\Eloquent\Model; class Mechanic extends Model { /** * Get the car's owner. */ public function carOwner() { return $this->hasOneThrough('App\Owner', 'App\Car'); } }
has many through laravel
class Country extends Model { public function posts() { return $this->hasManyThrough( 'App\Post', 'App\User', 'country_id', // Foreign key on users table... 'user_id', // Foreign key on posts table... 'id', // Local key on countries table... 'id' // Local key on users table... ); } } when countries id - integer name - string users id - integer country_id - integer name - string posts id - integer user_id - integer title - string
laravel has many
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class Post extends Model { /** * Get the comments for the blog post. */ public function comments() { return $this->hasMany('App\Models\Comment'); } }
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us