本文整理汇总了PHP中app\models\Task::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::select方法的具体用法?PHP Task::select怎么用?PHP Task::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Task
的用法示例。
在下文中一共展示了Task::select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_tasks
public static function get_tasks($card_id = false, $camp_id = false)
{
$task = Task::select('tasks.*', 'cards.name as card', 'camps.name as camp');
$task->join('cards', 'cards.id', '=', 'card_id', 'left');
$task->join('camps', 'camps.id', '=', 'camp_id', 'left');
if ($card_id) {
$task->where('tasks.card_id', $card_id);
}
if ($camp_id) {
$task->where('tasks.camp_id', $camp_id);
}
return $task->get();
}
示例2: task
public function task($type)
{
$tasks = null;
$query = null;
$title = ['状态 ', '完成时间', 'PRI', '任务编号', '任务标题', '客户名称', 'PM', '工作流版本', '开发人员', '工作量', '测试人员', '工作量', 'EKP任务', '实际任务', '备注'];
$file_name = '任务明细' . date("Ymd", strtotime("now"));
switch ($type) {
case 'year':
$query_begin = date("Y", mktime(0, 0, 0, date("m"), 1, date("Y")));
$tasks = Task::select('status', 'actual_finish_date', 'PRI', 'task_no', 'task_title', 'customer_name', 'abu_pm', 'erp_version', 'developer', 'developer_workload', 'tester', 'tester_workload', 'ekp_task_type', 'task_type', 'comment')->where('task_no', '>', $query_begin)->get();
$file_name = '本年' . $file_name;
break;
case 'month':
$query_begin = date("Ymd", mktime(0, 0, 0, date("m") - 1, 1, date("Y")));
$query_end = date("Ymd ", mktime(0, 0, 0, date("m") + 1, 1, date("Y")));
$tasks = Task::select('status', 'actual_finish_date', 'task_no', 'task_title', 'customer_name', 'abu_pm', 'erp_version', 'developer', 'developer_workload', 'tester', 'tester_workload', 'ekp_task_type', 'task_type', 'comment')->where('task_no', '>', $query_begin)->where('task_no', '<', $query_end)->orWhere('status', '<', 3)->get();
$file_name = '本月' . $file_name;
break;
case 'week':
$query_begin = date("Ymd", strtotime("-1 week Monday"));
$query_end = date("Ymd", strtotime("+0 week Monday"));
$tasks = Task::select('status', 'actual_finish_date', 'PRI', 'task_no', 'task_title', 'customer_name', 'abu_pm', 'erp_version', 'developer', 'developer_workload', 'tester', 'tester_workload', 'ekp_task_type', 'task_type', 'comment')->where('task_no', '>', $query_begin)->where('task_no', '<', $query_end)->get();
$file_name = '本周' . $file_name;
break;
case 'yd':
$tasks = Task::select('status', 'actual_finish_date', 'PRI', 'task_no', 'task_title', 'customer_name', 'abu_pm', 'erp_version', 'developer', 'developer_workload', 'tester', 'tester_workload', 'ekp_task_type', 'task_type', 'comment')->where('abu_pm', '刘嵩')->orderBy('task_no', 'DESC')->get();
$file_name = '本周' . $file_name;
break;
}
$cellData = [];
$cellData = $tasks->toArray();
//// print_r($tasks);
foreach ($cellData as $k => $val) {
if (date("Y-m-d", strtotime($val['actual_finish_date'])) === '1970-01-01' || date("Y-m-d", strtotime($val['actual_finish_date'])) === '-0001-11-30') {
$cellData[$k]['actual_finish_date'] = "";
} else {
$cellData[$k]['actual_finish_date'] = date("Y-m-d", strtotime($val['actual_finish_date']));
}
$cellData[$k]['status'] = Config('params.task_status')[$val['status']];
$cellData[$k]['developer'] = $val['dev_name'];
$cellData[$k]['tester'] = $val['tester_name'];
unset($cellData[$k]['dev_name']);
unset($cellData[$k]['tester_name']);
}
// print_r($cellData);
// die;
// print_r($cellData);
Excel::create($file_name, function ($excel) use($cellData) {
$excel->sheet('score', function ($sheet) use($cellData) {
$sheet->rows($cellData);
});
})->export('xls');
}
示例3: test_page
public function test_page()
{
// $users = Cache::get('user',function(){
// $users = DB::table('users')->select('code', 'name','role','admin')->get();
// Cache::forever('user', $users);
// });
// $user_code = 'wank,zhuangsd';
// if(!empty($user_code))
// {
// $arr_user_code = explode(',',$user_code);
// $user_name = [];
//// var_dump($users);
// if(count($arr_user_code) > 1){
// //循环数组,输出名字
// foreach($arr_user_code as $val) {
// foreach($users as $user){
// if($user->code == $val){
// $user_name[$val] = $user->name;
// }
// }
// if(empty($user_name[$val])){
// $user_name[$val] = '未知';
// }
// }
// }
// else{
// foreach($users as $user) {
// if($user->code == $user_code) {
// $user_name[$user_code] = $user->name;
// }
// }
// if(empty($user_name[$user_code])){
// $user_name[$user_code] = '未知';
// }
// }
// var_dump(join(',',$user_name));die;
// }
// else
// {
// echo '未知code';
// }
// $cellData = [
// ['学号','姓名','成绩'],
// ['10001','AAAAA','99'],
// ['10002','BBBBB','92'],
// ['10003','CCCCC','95'],
// ['10004','DDDDD','89'],
// ['10005','EEEEE','96'],
// ];
$query = '2016';
$title = ['任务编号 ', '任务标题', '客户名称', 'PM', '工作流版本', '开发人员', '测试人员', '备注', '开发人员', '测试人员'];
// $tasks = DB::table('tasks')->select('task_no', 'task_title','customer_name','abu_pm','erp_version','developer','tester','comment')->where('task_no','like',$query.'%')->get();
$tasks = Task::select('ekp_task_type', 'task_type', 'task_no', 'task_title', 'customer_name', 'abu_pm', 'erp_version', 'developer', 'developer_workload', 'tester', 'tester_workload', 'comment')->where('task_no', 'like', $query . '%')->orderBy('task_no')->get();
$cellData = [];
$cellData = $tasks->toArray();
// $cellData[] = $title;
Excel::create('本年任务明细-2016-05', function ($excel) use($cellData) {
$excel->sheet('score', function ($sheet) use($cellData) {
$sheet->rows($cellData);
});
})->export('xls');
// $x = Uuid::generate();
// echo $x;
// $customer_details = DB::table('customers')
// ->join('projects2workflow','customers.name','=','projects2workflow.project_name')
// ->select('customers.uuid','projects2workflow.*')
// ->get();
//
//// print_r($customer_details);
//
// foreach($customer_details as $val) {
// $customer_details = new CustomerDetail();
// $customer_details->customer_uuid = $val->uuid;
// $customer_details->customer_name = $val->project_name;
// $customer_details->path = $val->path;
// $customer_details->workflow_path = $val->workflow_path;
// $customer_details->assemblyInfo_path = $val->assemblyInfo_path;
// $customer_details->assemblyInfo = $val->assemblyInfo;
// $customer_details->assemblyFileInfo = $val->assemblyFileInfo;
// $customer_details->workflow_version = $val->workflow_version;
// $customer_details->erp_version = $val->erp_version;
// $customer_details->save();
//// print_r($customer);
// }
}