Skip to content

Instantly share code, notes, and snippets.

@phanngoc
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save phanngoc/77cd7b22e012ac95b80f to your computer and use it in GitHub Desktop.

Select an option

Save phanngoc/77cd7b22e012ac95b80f to your computer and use it in GitHub Desktop.
public function index()
{
//$interviews = InterviewSchedule::all()->candidate()->whereIn('status_record_id', [1, 2, 4 ,5])->get();
$res_interviews = array();
$interviews = InterviewSchedule::all();
foreach ($interviews as $key => $value) {
if(!$value->candidate()->where('status_record_id',3)->get()->isEmpty())
{
array_push($res_interviews,$value);
}
}
$interviews = $res_interviews;
// $interviews = DB::table('interview_schedules')
//->join('candidates', 'candidates.id', '=', 'interview_schedules.candidate_id')->whereIn('status_record_id', [1, 2, 4 ,5])->get();
//dd($res_interviews);
$employees = Employee::all();
$employall = array();
$employall += array('0' => 'None');
foreach ($employees as $key => $value) {
$employall += array($value->id => $value->lastname." ".$value->firstname);
}
$statusrecord = StatusRecord::lists('name', 'id');
return view('employee.interview',compact('statusrecord','interviews','employall'));
}
<?php
namespace App\Http\Controllers;
use App;
use App\Employee;
use Excel;
use App\Device;
use App\InformationDevice;
use App\KindDevice;
use App\ModelDevice;
use App\OperatingSystem;
use App\TypeDevice;
use App\ReceiveDevice;
use App\StatusDevice;
use File;
use Illuminate\Support\Facades\Redirect;
use Input;
use Request;
use App\InterviewSchedule;
use App\StatusRecord;
use App\Candidate;
use DB;
class InterviewController extends AdminController {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$interviews = InterviewSchedule::all()->candidate()->whereIn('status_record_id', [1, 2, 4 ,5])->get();
// $interviews = DB::table('interview_schedules')
// ->join('candidates', 'candidates.id', '=', 'interview_schedules.candidate_id')->whereIn('status_record_id', [1, 2, 4 ,5])->get();
dd($interviews);
$employees = Employee::all();
$employall = array();
$employall += array('0' => 'None');
foreach ($employees as $key => $value) {
$employall += array($value->id => $value->lastname." ".$value->firstname);
}
$statusrecord = StatusRecord::lists('name', 'id');
return view('employee.interview',compact('statusrecord','interviews','employall'));
}
public function save()
{
$data = Request::input('data');
InterviewSchedule::find($data['id'])->update($data);
InterviewSchedule::find($data['id'])->candidate()->first()->update(['status_record_id'=>$data['status_record_id']]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment