本文整理匯總了PHP中app\models\Project::select方法的典型用法代碼示例。如果您正苦於以下問題:PHP Project::select方法的具體用法?PHP Project::select怎麽用?PHP Project::select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\models\Project
的用法示例。
在下文中一共展示了Project::select方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_projects_bylogin
public static function get_projects_bylogin()
{
$project = Project::select('name', 'id', 'active', 'status');
if (Auth::user()->group_id == 2) {
$project->where('added_by', Auth::user()->id);
}
return $project->get();
}
示例2: get_camp_planned_goals
/**
* Get the completed camps goals details of the cards for specified project
* params @int $id
*
* return array
*/
public static function get_camp_planned_goals($id)
{
$planned_goals = Project::select(DB::Raw('sum(rb_camps.budget) as budget'), DB::Raw('count(rb_camps.id) as camps'), DB::Raw('sum(rb_camps.no_of_people) as total_villagers'), DB::Raw('sum(rb_camps.order) as orders'), DB::Raw('avg(rb_camps.deliver_time) as deliver_time'));
$planned_goals->join('cards', 'cards.project_id', '=', 'projects.id');
$planned_goals->join('camps', 'camps.card_id', '=', 'cards.id');
$planned_goals->where('projects.id', $id);
return $planned_goals->first();
}