Answers for "query relationship laravel"

PHP
0

laravel where on relationsship column

Player::whereHas('roleplay', function($q){
   $q->where('column_name', 'value');
})->get();
Posted by: Guest on December-30-2020
2

associate laravel

When updating a belongsTo relationship, you may use the associate method. This 
method will set the foreign key on the child model:

	$account = AppAccount::find(10);
	$user->account()->associate($account);
	$user->save();

When removing a belongsTo relationship, you may use the dissociate method. This
method will set the relationship foreign key to null:

	$user->account()->dissociate();
	$user->save();
Posted by: Guest on December-07-2020
0

Laravel DB facade relations

$antiques = DB::table('antiques')
    ->join('images', 'images.antiques_id', '=', 'antiques.id')
    ->latest()
    ->limit(20)
    ->get(['antiques.*', 'images.path']);
Posted by: Guest on November-03-2020

Code answers related to "query relationship laravel"

Browse Popular Code Answers by Language