本文整理汇总了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();
}