I have the following relationships set up in Laravel:
OrderStatus Model - hasMany(\'Order\') Order Model - \'belongsTo(\'OrderStatus\');
Sure you can do this:
$status = OrderStatus::where(['name'=>'sample_status'])->firstOrFail(); $order = new Order; $order->status()->associate($status); $order->save();
(status() is the belongsTo relation. You might need to adjust that name)
status()