php - Multiple queries in laravel scope function -


I am trying to create multiple queries in a scope function in Laravel. My code is as follows: The first query is implemented normally but the second is ignored. Is this the right way to do is to

  public function scopeUpdateStatus ($ query, $ oldUser, $ NEWUSER, $ alias, $ env) {$ query- & gt; Where ('db_conn_app_alias_user', $ NEWUSER) - & gt; Where ('db_conn_app_alias', $ aka) - & gt; Where ('app_instance_environment', $ env) - & gt; Update (array ('user_status' = & gt; 'active')); $ Query-> Where ('db_conn_app_alias_user', $ oldUser) - & gt; Where ('db_conn_app_alias', $ aka) - & gt; Where ('app_instance_environment', $ env) - & gt; Update (array ('user_status' = & gt; 'inactive')); Return "Success"; }  

The trick here (to use with a Larjrl helper function) and cloned.

function scopeAllowed name ($ query) {(clone $ query) - & gt; Where stuff; (Clone $ query) - & gt; Where otherwise; }

Comments