I want add subquery to my model in laravel. I have order model with standard class and i can take all model columns using:
$order = Order::find(3);
But i need add method to class order like CHECKLIST. This checklist is the same for any order like:
SELECT o.*, (SELECT * FROM checklist) FROM order o WHERE o.id = 3
Is any way to add this subquery as method in class ?
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Order extends Model
{
use SoftDeletes;
public function checklist() {
return
}
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2yCp886
via IFTTT
Aucun commentaire:
Enregistrer un commentaire