Answers for "laravel eloquent get relations with record"

PHP
0

laravel relations find

$comment = Post::find(1)->comments()
                    ->where('title', 'foo')
                    ->first();
Posted by: Guest on May-26-2021
0

laravel relations find

return $this->hasMany(Comment::class, 'foreign_key');

return $this->hasMany(Comment::class, 'foreign_key', 'local_key');
Posted by: Guest on June-10-2021

Code answers related to "laravel eloquent get relations with record"

Browse Popular Code Answers by Language