本文整理汇总了PHP中Job::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::where方法的具体用法?PHP Job::where怎么用?PHP Job::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job
的用法示例。
在下文中一共展示了Job::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: anyEmployerOpen
public function anyEmployerOpen()
{
$user = Sentry::getUser();
$jobs = Job::where("user_id", '=', $user->id)->where("job_status_id", '=', JobStatus::$OPEN)->where('start_date', '>=', date('Y-m-d'))->orderBy('start_date', 'asc')->get();
$jobs->load('jobApplicants', 'address');
return View::make('jobs.employer_open', compact('jobs'));
}
示例2: boot
public static function boot()
{
parent::boot();
static::creating(function ($workerunit) {
// dd($workerunit);
// Inherit type, domain and format
if (empty($workerunit->type) or empty($workerunit->domain) or empty($workerunit->format)) {
$j = Job::where('_id', $workerunit->job_id)->first();
$workerunit->type = $j->type;
$workerunit->domain = $j->domain;
$workerunit->format = $j->format;
}
$workerunit->annotationVector = $workerunit->createAnnotationVector();
// Activity if not exists
if (empty($workerunit->activity_id)) {
try {
$activity = new Activity();
$activity->label = "Workerunit is saved.";
$activity->softwareAgent_id = $workerunit->softwareAgent_id;
$activity->save();
$workerunit->activity_id = $activity->_id;
Log::debug("Saving workerunit {$workerunit->_id} with activity {$workerunit->activity_id}.");
} catch (Exception $e) {
if ($activity) {
$activity->forceDelete();
}
//if($workerunit) $workerunit->forceDelete();
throw new Exception('Error saving activity for workerunit.');
}
}
});
}
示例3: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$jobs = Job::with('creator')->orderBy('required_date')->paginate(4);
if (Input::has('search')) {
$search = Input::get('search');
$jobs = Job::where('description', 'LIKE', '%' . $search . '%')->paginate(50);
}
$data = array('jobs' => $jobs);
return View::make('temp_jobs.index')->with($data);
}
示例4: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$this->line('Welcome to the job cron.');
$auto_close = Configuration::where('key', 'auto_close')->first();
if ($auto_close['value']) {
$auto_close_time = Configuration::where('key', 'auto_close_time')->first();
$diff_time = date("Y-m-d H:i:s", time() - $auto_close_time['value'] * 60 * 60);
$jobs = Job::where('status', '=', '1')->where('invalid', '=', '0')->where('start_time', '<', $diff_time)->get();
foreach ($jobs as $job) {
Job::where('id', $job->id)->update(array('status' => 2));
}
}
$this->line('Done !');
}
示例5: fire
/**
* Execute the console command
*
* @return void
*/
public function fire()
{
$job_name = $this->argument('jobname');
list($collection_uri, $name) = InputController::getParts($job_name);
// Check if the job exists
$job = \Job::where('name', '=', $name)->where('collection_uri', '=', $collection_uri)->first();
if (empty($job)) {
$this->error("The job with identified by: {$job_name} could not be found.\n");
exit;
}
$this->line('The job has been found.');
$job_exec = new JobExecuter($job, $this);
$job_exec->execute();
}
示例6: fire
/**
* Execute the console command
*
* @return void
*/
public function fire()
{
// Check for a list option
$list = $this->option('list');
$job_name = $this->argument('jobname');
if (empty($list) && !empty($job_name)) {
$inputController = new InputController();
list($collection_uri, $name) = $inputController->getParts($job_name);
// Check if the job exists
$job = \Job::where('name', '=', $name)->where('collection_uri', '=', $collection_uri)->first();
if (empty($job)) {
$this->error("The job with identified by: {$job_name} could not be found.\n");
exit;
}
$this->info('The job has been found.');
// Configure a log handler if configured
$this->addLogHandler();
$startDate = new Carbon();
$iso8601 = $startDate->toISo8601String();
\Log::info("Executing job {$name} at {$iso8601}");
try {
$job_exec = new JobExecuter($job, $this);
$job_exec->execute();
} catch (\Exception $ex) {
$endDate = new Carbon();
$iso8601 = $endDate->toISO8601String();
\Log::error("The job {$job_name} has failed at {$iso8601}");
\Log::error($ex->getMessage());
\Log::error($ex->getTraceAsString());
}
$endDate = new Carbon();
$iso8601 = $endDate->toISO8601String();
$job->date_executed = time();
$job->added_to_queue = false;
$job->save();
\Log::info("The job has ended at {$iso8601}");
} else {
$jobs = \Job::all(['name', 'collection_uri'])->toArray();
if (!empty($jobs)) {
$this->info("=== Job names ===");
foreach ($jobs as $job) {
$this->info($job['collection_uri'] . '/' . $job['name']);
}
} else {
$this->info("No jobs found.");
}
}
}
示例7: loadJob
public function loadJob($id)
{
$squeeb = Job::where('id', '=', $id)->first();
View::share('squeeb', $squeeb);
view::share('model', 'Job');
//detect device
$detect = new Mobile_Detect();
$deviceType = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer';
View::share('deviceType', $deviceType);
//update the squeeb table
$this->sqFactor($squeeb);
if (Auth::user()) {
return View::make('member.squeeb');
}
return View::make('guest.squeeb');
}
示例8: search
public function search()
{
if (Auth::check()) {
//do not show jobs that have already been applied to
//to show active jobs that helper has been selected for
$activeJobIds = DB::table('jobs')->join('helpers_jobs_mapping', function ($join) {
$join->on('jobs.id', '=', 'helpers_jobs_mapping.job_id')->where('helpers_jobs_mapping.is_accepted', '=', 1);
})->lists('id');
$activeJobs = [];
if (!empty($activeJobIds)) {
$activeJobs = Job::whereIn('id', $activeJobIds)->get();
}
$appliedQuery = Auth::user()->appliedJobs();
if (!empty($activeJobIds)) {
$appliedQuery->whereNotIn('id', $activeJobIds);
}
$appliedJobs = $appliedQuery->get();
//$jobsIds will hold all the ids in the jobs table
$appliedJobIds = array();
//search all jobs for current job id
foreach (Auth::user()->appliedJobs as $job) {
$appliedJobIds[] = $job->id;
}
$jobQuery = Job::with('creator');
if (count($activeJobIds) > 0) {
$jobQuery->whereNotIn('id', $activeJobIds);
}
if (count($appliedJobIds) > 0) {
$jobQuery->whereNotIn('id', $appliedJobIds);
}
//show all jobs if user has not applied to any
$jobs = $jobQuery->orderBy('required_date')->paginate(5);
$data = array('jobs' => $jobs, 'activeJobs' => $activeJobs, 'appliedJobs' => $appliedJobs);
} else {
$jobs = Job::with('creator')->orderBy('required_date')->paginate(5);
}
if (Input::has('filter')) {
$filter = Input::get('filter');
$jobs = Job::where('category', $filter)->paginate(50);
}
if (Input::has('search')) {
$search = Input::get('search');
$jobs = Job::where('description', 'LIKE', '%' . $search . '%')->paginate(5);
}
$data = array('jobs' => $jobs);
return View::make('pages.search')->with($data);
}
示例9: index
public function index()
{
$query = Job::where('status', '=', Job::APPROVED)->where('closing_date', '>=', \Carbon\Carbon::now())->where('published_date', '<=', \Carbon\Carbon::now());
if (\Input::get('type') && in_array(\Input::get('type'), array(Job::PERMANENT, Job::TEMPORARY))) {
$query->where('type', '=', \Input::get('type'));
}
if (\Input::get('time') && in_array(\Input::get('time'), array(Job::FULL_TIME, Job::PART_TIME))) {
$query->where('time', '=', \Input::get('time'));
}
if (\Input::get('keywords')) {
$keywords = \Input::get('keywords');
if (!empty($keywords)) {
$query->whereRaw("MATCH(title,description,reference,location,search_extra,meta_description,meta_keywords) AGAINST(? IN BOOLEAN MODE)", array($keywords));
}
}
$query->orderby('published_date', \Config::get('laravel-jobs::index_order'));
$jobs = $query->paginate(\Config::get('laravel-jobs::results_per_page'));
return \View::make(\Config::get('laravel-jobs::index_view'))->with(compact('jobs'));
}
示例10: function
if ($payload['exp'] < time()) {
Response::json(array('message' => 'Token has expired'));
}
});
Route::filter('auth.job', function ($route) {
if (!Request::header('Authorization')) {
return Response::json(array('message' => Request::header()), 401);
}
$token = explode(' ', Request::header('Authorization'))[1];
$payloadObject = JWT::decode($token, Config::get('secrets.TOKEN_SECRET'));
$payload = json_decode(json_encode($payloadObject), true);
if ($payload['exp'] < time()) {
Response::json(array('message' => 'Token has expired'));
}
$id = $route->getParameter('id');
$exist = Job::where('id', $id)->where('user_id', userId())->get()->toArray();
if (empty($exist)) {
return Response::json(array('message' => 'You are not allowed access to this record. You have been logged out.'), 401);
}
});
Route::filter('auth.basic', function () {
return Auth::basic();
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
示例11: getProcesscrowdgames
public function getProcesscrowdgames()
{
$gameJobs = Job::where('softwareAgent_id', 'DrDetectiveGamingPlatform')->get();
$activity = new Activity();
$activity->softwareAgent_id = 'DrDetectiveGamingPlatform';
$activity->save();
foreach ($gameJobs as $job) {
// $annotations = Entity::where('jobParents', $job['_id'])->get();
// Create one annotation vector for each image on the game
$images = Entity::where('jobParents', $job['_id'])->distinct('content.task_data')->get();
$annotationsSummary = [];
foreach ($images as $image) {
$imageName = $image[0];
// unpack data
$annotations = Entity::where('jobParents', $job['_id'])->where('content.task_data', $imageName)->get();
$annotations = $annotations->toArray();
// Create an array with all coordinates given for target image.
$coordinates = array_column(array_column(array_column($annotations, 'content'), 'response'), 'Coordinates');
$allCoordinates = [];
foreach ($coordinates as $coords) {
// Flatten to array of coords.
foreach ($coords as $c) {
$allCoordinates[] = $c;
}
}
$aggCoords = static::aggregateCoordinates($allCoordinates);
$annotationsSummary[] = ['image' => $imageName, 'aggregateCoordinates' => $aggCoords];
}
// process annotations for this job into an annotation vector...
$e = new Entity();
$e->jobParents = [$job['_id']];
$e->annotationVector = $annotationsSummary;
$e->documentType = 'annotationVector';
$e->activity_id = $activity->_id;
$e->softwareAgent_id = $job->softwareAgent_id;
$e->project = $job->project;
$e->user_id = $job->user_id;
$e->save();
}
return 'OK -- may need adjustments...';
}
示例12: e
} else {
?>
<p class="flash-message static error"><?php
echo e($this->fatalError);
?>
</p>
<p><a href="<?php
echo Backend::url('gatto/jobs/qualifications');
?>
" class="btn btn-default">Return to Qualifications list</a></p>
<?php
}
?>
This is a query for the front-end, using Laravel query builder:
it retrieves all the appointments for the logged in customer.
<?php
$this['appointments'] = Appointments::where('customer_id', '=', Auth::getUser()->id)->where('gatto_jobs_appointments.id', '=', $app_id)->join('gatto_jobs_jobs', 'gatto_jobs_appointments.job_id', '=', 'gatto_jobs_jobs.id')->join('users', 'gatto_jobs_appointments.customer_id', '=', 'users.id')->join('gatto_jobs_timeslots', 'gatto_jobs_timeslots.id', '=', 'time_slot')->get(['gatto_jobs_appointments.*', 'gatto_jobs_jobs.name as name', 'gatto_jobs_timeslots.name as timeslot', 'users.name as username'])->toArray();
?>
This is a simple Eloquent query to find a Job from an ID:
<?php
$this['selected_job'] = Job::where('id', '=', $this['job_id'])->first()->toArray();
示例13: index
public function index()
{
$jobs = Job::where('user_id', userId())->get()->toArray();
return Response::json(['data' => $jobs], 200);
}
示例14: getReinvalid
/**
* getReinvalid
*
* @param null $job_id
*
* @return mixed
*/
public function getReinvalid($job_id = NULL)
{
if (is_null($job = Job::where('member_id', '=', Auth::user()->id)->find($job_id))) {
return Redirect::to('ticket')->with('error', '工单不存在');
}
$job->where('id', $job_id)->update(array('invalid' => 0));
return Redirect::to('ticket')->with('success', '工单恢复成功');
}
示例15: JobsInterestedIn
public static function JobsInterestedIn(StudentInfo $student, $studentAddress = null)
{
if ($studentAddress == null) {
$studentAddress = $student->primaryAddress;
}
$preferredCategories = $student->studentJobPreferences->lists('job_category_id');
return Job::where('job_status_id', '=', JobStatus::$OPEN)->whereIn("jobs.job_category_id", $preferredCategories)->where("jobs.start_date", ">=", date("Y-m-d"))->orderBy('jobs.start_date', 'asc')->select("jobs.*", Address::distanceSelectStatement($studentAddress->latitude, $studentAddress->longitude, 'distance', 'jobs'))->having("distance", "<=", $student->studentProfile->preferred_job_radius)->get();
}