lundi 19 février 2018

Laravel: how to write query without a target

It's posible to create a query first and then assign it to a select?

something like this

$queryWithoutTarget = new Builder();

$queryWithoutTarget->where('x','y')->whereNull('z');

$workersQuery = Worker::select();

// I know this is Totally wrong, because queryWithoutTarget is not a parameter of $workersQuery
$workersQuery = $workersQuery->queryWithoutTarget;

I'm trying to be able to encapsulate queries in functions and then be able to execute them to any model or table



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire