/** * Display a listing of the resource. * * @return Response */ public function index(Job $jobs) { // return response()->json(['name' => 'Abigail', 'state' => 'CA']); // // Returns all jobs as Json data return $jobs->all()->toArray(); }
public function xml() { $xml = file_get_contents(public_path('xml') . '/test.xml'); $xml = simplexml_load_string($xml, null, LIBXML_NOCDATA); $xml = json_encode($xml); $xml = json_decode($xml, TRUE); $client_name = $xml['@attributes']['client_name']; foreach ($xml['job'] as $xml_job) { $job = new Job(); $job->client_name = $client_name; $job->title = $xml_job['title']; $job->address_1 = $xml_job['location_address1']; $job->address_2 = $xml_job['location_address2']; $job->city = $xml_job['location_city']; $job->state = $xml_job['location_state']; $job->zip = $xml_job['location_zip']; $job->country = $xml_job['location_country']; $job->job_id = $xml_job['job_id']; $job->description = $xml_job['description']; $job->category = $xml_job['category']; $job->sub_category = $xml_job['subcat']; $job->recruiter_id = $xml_job['recruiter_id']; $job->recruiter_first = $xml_job['recruiter_name_first']; $job->recruiter_last = $xml_job['recruiter_name_last']; $job->language = $xml_job['language']; $job->market = $xml_job['market']; /** this is causing an error when blank because it creates an empty array */ //$job->recruiter_email = $xml['job']['recruiter_email']; $job->start_date = strtotime($xml_job['date_start']); $job->end_date = strtotime($xml_job['date_end']); $job->save(); } }
public static function addJob($id, $function, $data) { $client = new \GearmanClient(); $client->addServer(gearman_server, gearman_port); $job = new Job(); $job->setId($id)->setExpireTime(time() + 172800)->setReference(array('CLIController', $function, $data)); $job_handle = $client->doBackground(app_name . 'handle', serialize($job)); Log::write(__METHOD__ . ' invoked gearman job (' . $function . ') for id ' . $id . ' ' . app_name . 'handle' . ' ' . $client->returnCode()); }
public function getView($id) { $company = Company::where("id", $id)->with(['customers' => function ($q) { $q->whereNull("user_id"); }])->first(); return view("company_profile.company_profile", ["company" => $company, "estimators" => User::where("company_id", $id)->count(), "jobs" => Job::where("company_id", $id)->count(), "customers" => $company->customers->count(), "estimatorz" => User::where("company_id", $id)->get()]); }
/** * Montre la vue pour créer un article * * @return Response */ public function create(Request $request) { $auth_id = Auth::user()->id; $categories = Category::lists('name', 'id'); $jobs = Job::lists('name', 'id'); return view('admin.posts.create', compact('auth_id', 'categories', 'jobs')); }
public function getEntry(Request $request, $job_number) { $singleObj = Job::where('job_number', $job_number)->first(); $headTitle = '案件に応募'; return view('jobs.entry', ['singleObj' => $singleObj, 'headTitle' => $headTitle]); //echo $_SERVER['DOCUMENT_ROOT']; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $jobs = Job::take(6)->get(); $posts = Post::published()->orderBy('created_at', 'desc')->where('category_id', '1')->get()->take(3); $vignettes = Post::published()->orderBy('created_at', 'desc')->where('category_id', '1' and 'is_sticky', '0')->skip(3)->take(6)->get(); return view('pages.home.index', compact('jobs', 'posts', 'vignettes')); }
/** * Run the database seeds. * * @return void */ public function run() { // //assign all jobs to test user $user = \App\User::where('username', '=', 'Tester')->first(); $settings = array('draw' => 15000, 'paper_type' => 1); $job = new \App\Job(); $job->site_id = 2; $job->type = "press"; $job->user_id = $user->id; $job->pub_id = 1; $job->run_id = 1; $job->equipment_id = 1; $job->tied_to_id = 0; $job->recurrence_id = 0; $job->product_date = date("Y-m-d"); $job->request_date = date("Y-m-d"); $job->start = date("Y-m-d", strtotime("-1 day")) . ' 11:30:00'; $job->end = date("Y-m-d", strtotime("-1 day")) . ' 13:30:00'; $job->source = "seeder"; $job->settings = $settings; $job->save(); \App\Job::create(['site_id' => 2, 'type' => "press", "user_id" => $user->id, "pub_id" => 1, "run_id" => 2, "equipment_id" => 1, "tied_to_id" => 0, "recurrence_id" => 0, "product_date" => date("Y-m-d", strtotime("+1 day")), "request_date" => date("Y-m-d", strtotime("+1 day")), "start" => date("Y-m-d") . ' 10:45:00', "end" => date("Y-m-d") . ' 12:00:00', "source" => "seeder", 'settings' => $settings]); \App\Job::create(['site_id' => 3, 'type' => "press", "user_id" => $user->id, "pub_id" => 2, "run_id" => 3, "equipment_id" => 1, "tied_to_id" => 0, "recurrence_id" => 0, "product_date" => date("Y-m-d", strtotime("+2 days")), "request_date" => date("Y-m-d", strtotime("+2 days")), "start" => date("Y-m-d", strtotime("+1 day")) . ' 15:15:00', "end" => date("Y-m-d", strtotime("+1 day")) . ' 16:30:00', "source" => "seeder", 'settings' => $settings]); }
/** * Search jobs methods * @param \Illuminate\Http\Request $request * * @return $this */ public function search(Request $request) { $keywords = $request->keywords; $searchJobs = Job::where('title', 'LIKE', '%' . $keywords . '%')->orWhere('type', 'LIKE', '%' . $keywords . '%')->get(); $data = ['searchJobs' => $searchJobs]; return view('search')->with($data); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $events = Event::where('user_id', $user_id)->get(); $jobs = Job::where('user_id', $user_id)->get(); // return view('members.dashboardpage', ['user' => $user, 'events' => $events, 'jobs' => $jobs]); return view('public.frontpage', ['user' => $user, 'events' => $events, 'jobs' => $jobs]); }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker\Factory::create(); foreach (range(1, 20) as $index) { Job::create(['position' => $faker->bs]); } }
public function postAddJobLayout(Request $request) { $request['user_id'] = Auth::user()->id; if ($request['logo_image']) { $destinationPath = 'uploads'; // upload path $extension = Input::file('logo_image')->getClientOriginalExtension(); // getting image extension $fileName = time() . '.' . $extension; // renameing image $request['logo'] = $fileName; Input::file('logo_image')->move($destinationPath, $fileName); } if ($request['header_image']) { $destinationPath = 'uploads'; // upload path $extension = Input::file('header_image')->getClientOriginalExtension(); // getting image extension $headerfile = time() + 1 . '.' . $extension; // renameing image Input::file('header_image')->move($destinationPath, $headerfile); $request['header'] = $headerfile; } $jobaddlayout = Jobaddlayout::create($request->all()); return view('job.index')->with('job', Job::find($request['job_id']))->with('educationalqualifications', Educationalqualification::lists('name', 'id'))->with('joblevels', Joblevel::lists('name', 'id'))->with('industries', Industry::lists('name', 'id'))->with('jobtypes', Jobtype::lists('name', 'id'))->with('jobcategories', Jobcategory::lists('name', 'id'))->with('level', 2); return $request; }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $jobs = Job::find($id); if (!$jobs) { return $this->respondNotFount('No jobs here dude !'); } return $this->respond(['data' => $this->jobsTransformer->transform($jobs)]); }
/** * Permet de mettre à jour * * @return Response */ public function update(Request $request) { $id = $request->job_id; $resume = $request->resume; $content = $request->content; $fiches = Job::where('id', $id)->update(['resume' => $resume, 'content' => $content]); return redirect(route('admin.metiers.index', compact('fiches'))); }
/** * 玩家卡片取得处理 */ public function cardBox() { // 玩家ID获取 $intPlayerId = Input::get('player_id'); // 玩家所持卡片全取得 $lstCard = OwnedCard::where('player_id', $intPlayerId)->get(); return view('admin.player.card-box')->withCards(Card::all())->withAttrs(Attr::all())->withRaces(Race::all())->withJobs(Job::all())->withSkills(Skill::all())->withOwnedCards($lstCard); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // $input = $request->all(); $validator = Validator::make($input, ['price' => 'required', 'job_type' => 'required', 'job_id' => 'required', 'paper_id' => 'required']); if ($validator->fails()) { return \Redirect::back()->withErrors($validator)->withInput(); } array_forget($request, "_token"); $all_request = $request->all(); $price = Price::find($id); $papers = Paper::all(); $jobs = Job::all(); foreach ($all_request as $key => $value) { $price->{$key} = $value; } $price->update(); $prices = Price::all(); if ($request->ajax()) { if ($prices) { foreach ($prices as $price) { echo "\n <tr>\n <td>{$price->id}</td>\n <td>"; foreach ($papers as $paper) { if ($paper->id == $price->paper_id) { $paperid = $paper->name; echo $paper->name . ", " . $paper->size; } } echo " </td>\n <td>"; foreach ($jobs as $job) { if ($job->id == $price->job_id) { $jobid = $job->name; echo $job->name; } } echo "</td>\n <td>{$price->job_type}</td>\n <td>{$price->price}</td>\n <td><button class='edtPriceLink btn-primary' cpaperid='{$paperid}' cjobtype='{$price->job_type}' cid='{$price->id}' cjobid='{$price->job_id}' cprice='{$price->price}'><span class='glyphicon glyphicon-pencil'></span></button></td>\n <td><button class='btn-danger' data-target='#myModalPaperEdit' data-toggle='modal'><span class='glyphicon glyphicon-trash'></span></button></td>\n </tr>\n "; } } exit; } else { try { if ($price->update()) { \Session::flash("success_message", "New Price Record Updated Successfully"); return \Redirect::back(); } } catch (\Illuminate\Database\QueryException $e) { \Session::flash("error_message", $e->getMessage()); return \Redirect::back(); } catch (\PDOException $e) { \Session::flash("error_message", $e->getMessage()); return \Redirect::back(); } catch (\Exception $e) { \Session::flash("error_message", $e->getMessage()); return \Redirect::back(); } } return View("settings.priceedit", ['jobs' => $jobs, 'papers' => $papers, 'title' => 'Job Setting']); }
public function setUp() { parent::setUp(); $apiKey = $this->settings['oanda']['apiKey']; $accountId = $this->settings['oanda']['accountId']; $type = $this->settings['oanda']['serverType']; $pairs = $this->settings['oanda']['pairs']; $this->oandaInfo = new Broker_Oanda($type, $apiKey, $accountId, $pairs); }
public function show($jobId) { try { $job = Job::findOrFail($jobId); } catch (ModelNotFoundException $e) { abort(404); } return view('job.show', ['job' => new JobPresenter($job)]); }
/** * Run the database seeds. * * @return void */ public function run() { // clear table \App\Job::truncate(); // add 1st row \App\Job::create(['posted_by' => 1, 'company' => 'Google Inc', 'title' => 'Front-end Developer', 'description' => 'Required: Web design, Sass, AngularJS, Grunt & Bower', 'salary' => '30000000', 'type_id' => 2]); // add 2nd row \App\Job::create(['posted_by' => 2, 'company' => 'Fender', 'title' => 'Audio engineer', 'description' => 'Live mixing, recording, reproduction', 'salary' => '10000000', 'type_id' => 1]); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { if (!Input::get('client_name') or !Input::get('title') or !Input::get('description')) { //422 unprocessable entity return $this->respondNotValidated('Parameters failed validation for creating a new job'); } Job::create(Input::all()); return $this->respondCreated('Job successfully created.'); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function getEstimations() { if (!Auth::check()) { return Redirect::to("/"); } $id = Auth::user()->id; $customer = Customer::where("user_id", $id)->with("user")->with("jobs")->first(); $total = Job::where("customer_id", $id)->count(); return view("customer.estimations", ["customer" => $customer, "total" => $total]); }
public function destroy($id) { $job = Job::find($id); if (!$job) { return response()->json(['message' => 'Record not found'], 404); } if (\Auth::user()->id != $job->company_id) { return response()->json(['message' => 'You haven\'t permission to delete this entry'], 401); } $job->delete(); }
/** * Display a listing of the resource. * * @return Response */ public function getIndex() { if (Auth::user()->admin != 99) { //Admin以外はアクセス不可 echo "アクセス出来ません<br />Not Admin<a href=\"/\">BACK</a>"; } else { $userObjs = User::where('admin', 10)->orderBy('created_at', 'desc')->get(); $jobObjs = Job::orderBy('created_at', 'desc')->get(); $studyObjs = $this->iroha->where('slug', 'study')->orderBy('created_at', 'desc')->get(); return view('dashboard.index', ['userObjs' => $userObjs, 'jobObjs' => $jobObjs, 'studyObjs' => $studyObjs]); } }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('jobs', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->timestamps(); }); Job::create(['name' => 'Developpeur']); Job::create(['name' => 'Designer']); Job::create(['name' => 'Community Manager']); Job::create(['name' => 'Web Marketer']); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $posts_published = Post::published()->count(); $posts_editing = Post::where('published', 'uc')->count(); $posts_sticky = Post::where('is_sticky', 'on')->count(); $posts = Post::count(); $users = User::count(); $jobs = Job::count(); $questions = Question::count(); $categories = Category::count(); return view('admin.stats.index', compact('posts', 'posts_published', 'posts_sticky', 'posts_editing', 'users', 'jobs', 'questions', 'categories')); }
/** * require Args array $args = array( 'time' => time(), 'userid' => '', 'oanda' => array( 'accountId' => '', ), ); */ public function setUp() { parent::setUp(); $accountId = $this->args['oanda']['accountId']; $account = R::findOne('accounts', ' accountid = ?', [$accountId]); if (!empty($account)) { $apiKey = $account['apikey']; $type = $account['servertype']; $this->oandaInfo = new Broker_Oanda($type, $apiKey, $accountId); } else { throw new \Exception('Oanda AccountId not found'); } }
public function removeFromFeaturedJobs(Request $request) { $job = $request->get('data'); if (!empty($job)) { $jobObj = \App\Job::find($job['id']); if (!empty($jobObj)) { $jobObj->featured_flag = 0; $jobObj->updated_at = $jobObj->created_at; $job_id = \App\Job::saveInstance($jobObj); } } return 'true'; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $jobs = Job::all(); $posts = Post::published()->orderBy('updated_at', 'desc')->where('category_id', '1')->get()->take(3); $vignettes = Post::published()->orderBy('updated_at', 'desc')->where('category_id', '1')->skip(3)->take(1000)->get(); if (isset($_GET['jobid']) && ($_GET['jobid'] > '0' && $_GET['jobid'] < '8')) { $jobid = $_GET['jobid']; $posts = Post::published()->take(3)->orderBy('updated_at', 'desc')->where('job_id', $_GET['jobid'])->where('category_id', '1')->get(); $vignettes = Post::published()->orderBy('updated_at', 'desc')->where('job_id', $_GET['jobid'])->where('category_id', '1')->skip(3)->take(1000)->get(); } // si jobid <1 ou >7 is_int return view('pages.blog.index', compact('posts', 'vignettes', 'jobs')); }
/** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { $schedule->command('export-monster-files test')->cron('00 * * * *')->name('process-feed')->withoutOverlapping(); $schedule->call(function () { $files = \App\FileDeleteQueue::all(); foreach ($files as $file) { $local_file = config('monster.tmp_storage_path') . $file->file_name; if (file_exists($local_file)) { $tmp_is_deleted = unlink(realpath($local_file)); if (!$tmp_is_deleted) { \App\ExportLog::create(['process' => 'deleting local file', 'filename' => $ftp_file, 'message' => 'cannot be deleted from /tmp/ folder']); } else { $file->delete(); } } } })->name('delete-local-files')->twiceDaily(12, 23); $schedule->call(function () { // deleting expired jobs $today = date('Y-m-d', time()); $jobs = \App\Job::where('end_date', '<', $today)->take(1000)->get(); if (!$jobs->isEmpty()) { $i = 0; foreach ($jobs as $j) { $j->delete(); $i++; } \App\ExportLog::create(['process' => 'deleting expired jobs', 'message' => 'Deleted ' . $i . ' jobs']); } })->cron('5 * * * *')->name('delete-expired-jobs-hourly')->withoutOverlapping(); $schedule->call(function () { $today = date('Y-m-d', time() - 3 * 86400); \App\ExportRecordFailure::where('created_at', '<', $today)->take(3000)->delete(); })->cron('5 * * * *')->name('delete-export-record-failures')->withoutOverlapping(); $schedule->call(function () { $queue = \App\CacheQueue::where(['in_process' => 0])->take(10); $records = $queue->get(); if (!$records->isEmpty()) { $queue->update(['in_process' => 1]); foreach ($records as $record) { $run = call_user_func($record->model . '::' . $record->method, $record->args); if ($run) { $record->delete(); } else { $record->in_process = null; $record->save(); } } } })->everyMinute()->name('process-cache-queue-records'); }
private function replyToJobSender($category, $recipient) { $jobs = $this->job->where('deadline', '>=', Carbon::today())->where('category', 'like', '%' . $category . '%')->orderBy('id', 'desc')->take(5)->get(); if (count($jobs) > 0) { foreach ($jobs as $job) { $message = "Job is {$job->jobType}, located at {$job->location}, contact {$job->contact} on {$job->contactName}, positions available {$job->positions}"; $this->send($recipient, $message); Log::debug("msg sent: " . $message); } } else { $message = "Sorry no jobs matching your category, try another category"; $this->send($recipient, $message); } }