public function allowedShipmentStatuses() { $shipment_id = Input::json('id'); $usergroup = User::find(Auth::id())->usergroup()->first(); $job_id = Shipments::find($shipment_id)->Job_Id; $job = Jobs::find($job_id); $channel_id = $job->Channel_Id; $job_status_id = $job->Job_Status_Id; //select form usergroup channel rights where the channel_id and usergroup_id and ch_right $status_list = DB::select(DB::raw("SELECT jts.* FROM jobtypestatus jts\n\t\t\t\tWHERE jts.JobTypeStatus_Id = " . $job_status_id . "\n\t\t\t\t\tor jts.JobTypeStatus_Id in\n\t\t\t\t\t\t(Select jtst.To_JobTypeStatus_Id\n\t\t\t\t\t\t\tFrom jobtypestatustransitions jtst\n\t\t\t\t\t\t\twhere jtst.From_JobTypeStatus_Id= '" . $job_status_id . "')")); return Response::json(array('response' => $status_list)); }