当前位置: 首页>>代码示例>>PHP>>正文


PHP Project::where方法代码示例

本文整理汇总了PHP中app\models\Project::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::where方法的具体用法?PHP Project::where怎么用?PHP Project::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Project的用法示例。


在下文中一共展示了Project::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSearch

 public function getSearch()
 {
     $keyword = \Input::get('keyword');
     $projects = Project::where('name', '=~', ".*{$keyword}.*")->paginate(6);
     $projects->appends(['keyword' => $keyword]);
     return view('users.project.main')->with('projects', $projects)->with('keyword', $keyword);
 }
开发者ID:clubttt,项目名称:SuccessModel4,代码行数:7,代码来源:UserController.php

示例2: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($user, $project_name, $story_id)
 {
     $project_name = str_post_slug($project_name);
     $project = Project::where('name', $project_name)->first();
     $project_id = $project->id;
     $story = Story::find($story_id);
     return view('user.story.show', compact('user', 'project_name', 'project_id', 'story', 'project'));
 }
开发者ID:sparkan,项目名称:Sparkous,代码行数:14,代码来源:StoryController.php

示例3: search

 public function search()
 {
     $ss = Input::get('searchbox');
     $data['orgs'] = Organisation::where('organisation', 'like', '%' . $ss . '%')->get();
     $data['pros'] = Project::where('project', 'like', '%' . $ss . '%')->get();
     $data['tags'] = Tag::where('tag', 'like', '%' . $ss . '%')->get();
     $data['ss'] = $ss;
     return view('search', $data);
 }
开发者ID:bishopm,项目名称:ncc,代码行数:9,代码来源:HomeController.php

示例4: sortByCriteria

 public function sortByCriteria($criteria = null, $authId = Null)
 {
     switch ($criteria) {
         case 'active':
             $users = $this->model->where('type', 'general')->where('status', '1')->count();
             return $users;
             break;
         case 'inactive':
             $users = $this->model->where('type', 'general')->where('status', '0')->count();
             return $users;
             break;
         case 'facebook':
             $users = $this->model->where('type', 'general')->where('register_type', 'facebook')->count();
             return $users;
             break;
         case 'googleplus':
             $users = $this->model->where('type', 'general')->where('register_type', 'googleplus')->count();
             return $users;
             break;
         case 'twitter':
             $users = $this->model->where('type', 'general')->where('register_type', 'twitter')->count();
             return $users;
             break;
         case 'all':
             $users = $this->model->where('type', 'general')->count();
             return $users;
             break;
         case 'my_posted_projects':
             $myPostedProjectLists = \App\Models\Project::where('active', '1')->where('user_id', $authId)->count();
             return $myPostedProjectLists;
             break;
         case 'my_posted_projects':
             $myPostedProjectLists = \App\Models\ProjectUpdates::where('active', '1')->where('user_id', $authId)->count();
             return $myPostedProjectLists;
             break;
         case 'my_backed_projects':
             $MyFundedProjectLists = array();
             $lists = \App\Models\ProjectFund::where('U_ID', $authId)->whereIn('status', ['Pledged', 'Funded'])->orderBy('created_at', 'desc')->get();
             if (count($lists) > 0) {
                 foreach ($lists as $val) {
                     $MyFundedProjectLists[] = $val->P_ID;
                 }
             }
             $result = array_unique($MyFundedProjectLists);
             return count($result);
             break;
         case 'my_likes_projects':
             $myLikeProjects = \App\Models\ProjectFollowers::where('user_id', $authId)->count();
             return $myLikeProjects;
             break;
         case 'my_following_projects':
             $myFllowingProjects = \App\Models\ProjectFollowers::where('user_id', $authId)->count();
             return $myFllowingProjects;
             break;
     }
 }
开发者ID:udayc,项目名称:travel,代码行数:56,代码来源:UserRepository.php

示例5: projects

 public function projects($search = null, $categories = null, $orderby = null, $paginate = true)
 {
     $result = null;
     /**
      * As buscas não são complementares: ou se filtra por termo ou por categoria(s)
      * mas nunca por ambos.
      */
     if ($paginate) {
         /**
          * SEARCH
          * Se existe um termo de busca, retorna a lista filtrada pelo termo
          */
         if (!is_null($search) && !empty($search)) {
             return Project::where('name', 'like', "%{$search}%")->paginate(env('PAGINATION_ITEMS', 10));
         }
         /**
          * CATEGORIES
          * Se existe uma ou mais categoria(s), retorna a lista filtrada por ela(s)
          */
         if (!is_null($categories) && !empty($categories)) {
             /**
              * Compila-se uma lista distinta projetos associados às caregorias informadas
              */
             $projectsFromCategories = DB::table('category_project')->whereIn('category_id', $categories)->distinct()->get(['project_id']);
             $projectIds = [];
             /**
              * Compila-se uma lista apenas com os IDs dos projetos pois
              * a lista acima possui array com objetos: [0 => StdClass('project_id': 1)]
              */
             foreach ($projectsFromCategories as $value) {
                 $projectIds[] = $value->project_id;
             }
             /**
              * Por fim retorna-se a lista dos projetos
              */
             return Project::whereIn('id', $projectIds)->paginate(env('PAGINATION_ITEMS', 10));
         }
         /**
          * ORDER BY
          * Se existe ordenação, retorna a lista ordenada pela instrução recebida
          */
         if (!is_null($orderby) && !empty($orderby)) {
             $order = explode('|', $orderby);
             return Project::orderBy($order[0], $order[1])->paginate(env('PAGINATION_ITEMS', 10));
         }
         /**
          * Caso nem exista nem termo de busca nem categorias, retorna-se a lista completa, paginada.
          */
         return Project::paginate(env('PAGINATION_ITEMS', 10));
     }
     /**
      * Este, sem paginação, visa atender à API
      */
     return Project::where('name', 'like', "%{$search}%")->get();
 }
开发者ID:ronal2do,项目名称:dave_brubeck,代码行数:55,代码来源:ProjectRepository.php

示例6: index

 public function index()
 {
     $search['text'] = Input::get('search_text');
     $search['type'] = Input::get('search_type');
     if ($search['type'] == 'user') {
         $list = Project::where('manage', 'like', "%{$search['text']}%")->orderBy('id', 'desc')->paginate(15);
     } else {
         if ($search['type'] == 'name') {
             $list = Project::where('name', 'like', "%{$search['text']}%")->orderBy('id', 'desc')->paginate(15);
         } else {
             $list = Project::orderBy('id', 'desc')->paginate(15);
         }
     }
     return View::make('admin.project_list')->withlist($list)->withsearch($search);
 }
开发者ID:snyh,项目名称:just-calc-dstore-info,代码行数:15,代码来源:ProjectController.php

示例7: postProject

 function postProject(Request $request)
 {
     /* Make sure the requesting user has a group */
     $group = Auth::user()->student->group;
     if (!$group) {
         return redirect('student/project');
     }
     $project_id = $request->get('project');
     /* When an advanced project has been assigned, no change is possible */
     if (!Project::where('advanced', 0)->find($project_id)) {
         return redirect('student/project');
     }
     $project = $group->project;
     /* Store the change, but only when not chosen or before deadline. */
     if (!$project || !(time() > strtotime(env("WEBDB_PROJECT_DEADLINE")) || $project->advanced)) {
         $group->project()->associate(Project::find($project_id));
         $group->save();
     }
     return redirect('student/project');
 }
开发者ID:robindv,项目名称:WebDB,代码行数:20,代码来源:StudentController.php

示例8: Projectlist

 public function Projectlist($id = Null, $type = Null)
 {
     $projcon = array("0", "3");
     if ($type == 'genres') {
         $staffPickRow = Project::where('active', '1')->where('live', '1')->where('project_genre_id', $id)->where('featured', '1')->take(1)->get();
         if (count($staffPickRow) > 0) {
             $allLists = Project::where('active', '1')->where('live', '1')->where('project_genre_id', $id)->where('featured', '1')->take(1)->get();
         } else {
             $allLists = Project::where('active', '1')->where('live', '1')->where('project_genre_id', $id)->orderBy('created_at', 'desc')->take(1)->get();
         }
     } elseif ($type == 'categories') {
         $allLists = Project::where('active', '1')->where('live', '1')->where('P_CAT_ID', $id)->whereIn('featured', ['0', '1'])->take(1)->get();
     } elseif ($type == 'popular') {
         $allLists = Project::where('active', '1')->where('live', '1')->orderBy('rank', 'DESC')->take(3)->get();
     } elseif ($type == 'latest') {
         $allLists = Project::where('active', '1')->where('live', '1')->orderBy('created_at', 'desc')->take(3)->get();
     } else {
         $allLists = Project::where('active', '1')->where('live', '1')->get();
     }
     $result = $this->project_repo->prepareListObj($allLists);
     return $result;
 }
开发者ID:udayc,项目名称:travel,代码行数:22,代码来源:WelcomeController.php

示例9: getIndex

 public function getIndex($criteria = Null)
 {
     Session::put('step', '1');
     Session::put('last_insert_id', '');
     $searchKey = \Input::get('srch-term') ? \Input::get('srch-term') : Null;
     $projects = Project::whereIn('active', [0, 1]);
     if ($criteria != Null) {
         switch ($criteria) {
             case "active":
                 $projects = Project::where('active', 1);
                 break;
             case "inactive":
                 $projects = Project::where('active', 0);
                 break;
             case "featured":
                 $projects = Project::where('featured', 1);
                 break;
             case "suspended":
                 $projects = Project::where('status', 1);
                 break;
             case "flaged":
                 $projects = Project::where('flag', 1);
                 break;
             case "uflaged":
                 $projects = Project::where('user_flagged', 1);
                 break;
         }
     }
     if ($searchKey != Null) {
         $projects->Where(function ($query) use($searchKey) {
             //echo $searchKey; exit;
             $query->where('name', 'LIKE', '%' . $searchKey . '%');
         });
     }
     $results = $projects->orderBy('id', 'desc')->paginate($this->show_per_page);
     return view('admin.project.index', ['projects' => $results, 'searchKey' => $searchKey, 'dataStat' => $this->project_repo->projectDataStat()]);
 }
开发者ID:udayc,项目名称:travel,代码行数:37,代码来源:MessageController.php

示例10: all

 public function all($type = Null, $criteria = Null)
 {
     switch ($type) {
         case "project":
             if ($criteria != Null) {
                 $lists = \App\Models\Project::where('status', $criteria)->count();
             } else {
                 $lists = \App\Models\Project::all()->count();
             }
             break;
         case "user":
             $lists = \App\User::all()->count();
             break;
         case "category":
             $lists = \App\Models\Category::all()->count();
             break;
         case "genre":
             $lists = \App\Models\Genre::all()->count();
             break;
         default:
             $lists = 0;
     }
     return $lists;
 }
开发者ID:udayc,项目名称:travel,代码行数:24,代码来源:DashboardRepository.php

示例11: getUimodal

 public function getUimodal($modalFor, $user_id)
 {
     if (isset($modalFor) && $modalFor == 'project-count') {
         $projectLists = \App\Models\Project::where('user_id', $user_id)->get();
         echo view('admin.user.uimodal', ['modalFor' => $modalFor, 'user_id' => $user_id, 'projectLists' => $projectLists]);
     } elseif (isset($modalFor) && $modalFor == 'user-login-count') {
         $logHistory = \App\Models\LogActivity::where('user_id', $user_id)->where('action', 'user-login')->orderBy('timestamp')->get();
         echo view('admin.user.uimodal', ['modalFor' => $modalFor, 'user_id' => $user_id, 'logHistory' => $logHistory]);
     } elseif (isset($modalFor) && $modalFor == 'project_funded_count') {
         $fundedDetails = \App\Models\ProjectFund::where('U_ID', $user_id)->where('status', 'Pledged')->orderBy('created_at')->get();
         echo view('admin.user.uimodal', ['modalFor' => $modalFor, 'user_id' => $user_id, 'fundedDetails' => $fundedDetails]);
     }
 }
开发者ID:udayc,项目名称:travel,代码行数:13,代码来源:UserController.php

示例12: getOwedByUserAttribute

 /**
  * Get the total amount the current user owes the user
  * @return mixed
  */
 public function getOwedByUserAttribute()
 {
     $payer = Payer::find(Auth::user()->id);
     //Find the projects belonging to the current user and $this user
     $projects_with_payee = Project::where('payer_id', $payer->id)->where('payee_id', $this->id)->lists('id');
     //Find the timers belonging to those projects,
     //but only those that have not been paid for
     $timers_with_payee = Timer::whereIn('project_id', $projects_with_payee)->where('paid', 0)->lists('id');
     //Find the amount owed
     $owed = Timer::whereIn('id', $timers_with_payee)->sum('price');
     return (double) $owed;
 }
开发者ID:JennySwift,项目名称:project-tracker,代码行数:16,代码来源:User.php

示例13: getWidget

 public function getWidget($id)
 {
     $updateRank = $this->project_repo->updateprojectrank($id);
     $featuredProjects = Project::where('id', $id)->get();
     $total_backers = ProjectFund::where('P_ID', $id)->count();
     $total_fund = ProjectFund::where('P_ID', $id)->sum('paid_amount');
     $funded = number_format($total_fund / $featuredProjects[0]['funding_goal'] * 100) . "%";
     return view('project.embed', ['_featuredProducts' => $featuredProjects, '_totalBackers' => $total_backers, '_totalFunds' => $total_fund, '_funded' => $funded]);
 }
开发者ID:udayc,项目名称:travel,代码行数:9,代码来源:ProjectController.php

示例14: check_repeat

 private function check_repeat($projects_name)
 {
     $project = Project::where('projects_name', $projects_name)->count();
     if ($project) {
         return true;
     }
 }
开发者ID:QiuCarson,项目名称:doc,代码行数:7,代码来源:ProjectsController.php

示例15: function

| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    return view('home');
});
Route::get('/about', function () {
    return view('about');
});
Route::get('/contact', function () {
    return view('contact');
});
Route::get('/projects', function () {
    $projects = Project::where('active', 1)->get();
    return view('projects', ['projects' => $projects]);
});
Route::post('/contact', function (Request $request) {
    $name = $request->input('name');
    $email = $request->input('email');
    $message = $request->input('message');
    if ($email && $name && $message) {
        $contactData = ['name' => $name, 'email' => $email, 'message' => $message];
        Contact::create($contactData);
    }
    dispatch(new \App\Jobs\SendContactEmail($name, $email, $message));
    return view('mailSent');
});
/*
|--------------------------------------------------------------------------
开发者ID:RichNwankwo,项目名称:richnwan,代码行数:31,代码来源:routes.php


注:本文中的app\models\Project::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。