本文整理汇总了PHP中Status::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::where方法的具体用法?PHP Status::where怎么用?PHP Status::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::where方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apply
public function apply()
{
if (Session::has('user_id')) {
if (Input::has('storeId')) {
$storeId = Input::get('storeId');
$userId = Session::get('user_id');
$status = StatusModel::where('store_id', $storeId)->first();
$myQueue = QueueModel::where('store_id', $storeId)->where('user_id', $userId)->where('queue_no', '>', $status->current_queue_no)->whereRaw('DATE(created_at) = DATE(NOW())')->count();
if ($myQueue == 0) {
$queueNo = $status->last_queue_no;
$status->last_queue_no = $queueNo + 1;
$status->save();
$queue = new QueueModel();
$queue->store_id = $storeId;
$queue->user_id = $userId;
$queue->queue_no = $queueNo + 1;
$queue->save();
return Response::json(['result' => 'success', 'msg' => 'You have been successfully apply on this store']);
} else {
return Response::json(['result' => 'failed', 'msg' => 'You have already apply on this store', 'code' => 'CD00']);
}
} else {
return Response::json(['result' => 'failed', 'msg' => 'Invalid Request', 'code' => 'CD00']);
}
} else {
return Response::json(['result' => 'failed', 'msg' => 'You must login for apply', 'code' => 'CD01']);
}
}
示例2: getStatus
public static function getStatus($id)
{
switch ((int) $id) {
case self::SUCCESS:
return Status::where('id', '=', self::SUCCESS)->firstOrFail();
case self::FAILURE:
return Status::where('id', '=', self::FAILURE)->firstOrFail();
case self::SKIP:
return Status::where('id', '=', self::SKIP)->firstOrFail();
default:
return Status::where('id', '=', self::UNKNOWN)->firstOrFail();
}
}
示例3: apply
public function apply()
{
if (Input::has('store_id')) {
$storeId = Input::get('store_id');
$status = StatusModel::where('store_id', $storeId)->first();
$queueNo = $status->last_queue_no;
$status->last_queue_no = $queueNo + 1;
$status->save();
$store = StoreModel::find($storeId);
return Response::json(['result' => 'success', 'msg' => '', 'queue_no' => $queueNo + 1, 'created_at' => $status->updated_at->format('Y-m-d H:i:s'), 'logo' => HTTP_PATH . "/assets/img/logo.png"]);
} else {
return Response::json(['result' => 'failed', 'msg' => 'Invalid Request']);
}
}
示例4: findSelectedFilter
public function findSelectedFilter($filters, $aggregations, $status_filter)
{
if (!empty($status_filter)) {
$values = array();
$status_ranges = explode("-", $status_filter);
foreach ($status_ranges as $status_range) {
$statuses = Status::where('id', '=', $status_range);
if ($statuses->count()) {
$title = $statuses->first()->status;
array_push($values, array("title" => $title, "index" => 'status-remove-' . $status_range));
}
}
array_push($filters, array("name" => "Condition", "values" => $values, "modal" => "status"));
}
return $filters;
}
示例5: asyncNext
public function asyncNext()
{
$agent = AgentModel::find(Session::get('agent_id'));
$agent->is_active = true;
$agent->save();
$status = StatusModel::where('store_id', $agent->store_id)->first();
if (Session::has('process_id')) {
$process = ProcessModel::find(Session::get('process_id'));
$process->end_time = date('H:i:s');
if (Input::has('ticket_type') && Input::get('ticket_type') != '') {
$process->ticket_type = Input::get('ticket_type');
}
$process->save();
Session::forget('process_id');
}
if (Input::get('is_next') == '1') {
if ($status->current_queue_no + 1 <= $status->last_queue_no) {
$status->current_queue_no = $status->current_queue_no + 1;
$status->save();
$process = new ProcessModel();
$process->agent_id = Session::get('agent_id');
$process->queue_no = $status->current_queue_no;
$process->start_time = date('H:i:s');
$process->save();
Session::set('process_id', $process->id);
return Response::json(['result' => 'success', 'currentQueueNo' => $status->current_queue_no, 'lastQueueNo' => $status->last_queue_no, 'processId' => $process->id]);
} else {
$agent->is_active = false;
$agent->save();
return Response::json(['result' => 'failed', 'msg' => 'The queue is empty']);
}
} else {
$agent->is_active = false;
$agent->save();
return Response::json(['result' => 'failed', 'msg' => 'Your status is DEACTIVE']);
}
}
示例6: postStatus
public function postStatus($doc)
{
$toAdd = null;
$status = Input::get('status');
$doc = Doc::find($doc);
if (!isset($status)) {
$doc->statuses()->sync(array());
} else {
$toAdd = Status::where('label', $status['text'])->first();
if (!isset($toAdd)) {
$toAdd = new Status();
$toAdd->label = $status['text'];
}
$toAdd->save();
$doc->statuses()->sync(array($toAdd->id));
}
$response['messages'][0] = array('text' => 'Document saved', 'severity' => 'info');
return Response::json($response);
}
示例7: getStatusByName
public function getStatusByName($name)
{
return Status::where('title', $name)->firstOrFail();
}
示例8: findClientStatus
public static function findClientStatus($id_client = null, $id_user = null)
{
return Status::where('id_client', '=', $id_client)->get();
}
示例9: show
/**
* Display the specified resource.
*
* @param [int] $id
* @return [Response]
*/
public function show($id)
{
// Check if user has access to loan
if (!$this->user_loan_has_access($id)) {
Session::flash('alert_danger', 'Access denied.');
return Redirect::to('dashboard');
} else {
// Get loan info
$loan = $this->loan->getById($id);
$loan = $this->loan_add_status($loan);
$loan = $this->show_add_user_info($loan);
$conditions = $this->loan->getLoanConditions($loan["id"]);
foreach ($conditions as &$condition) {
$condition = $this->condition_add_info($condition);
}
$documents = $this->loan->getLoanDocuments($loan["id"]);
// For the update status form
$is_staff = $this->is_staff();
$statuses = Status::where('active', 1)->get()->toArray();
$condition_types = ConditionType::where('active', 1)->get()->toArray();
return View::make('auth.loan', ['loan' => $loan, 'documents' => $documents, 'conditions' => $conditions, 'is_staff' => $is_staff, 'statuses' => $statuses, 'condition_types' => $condition_types]);
}
}