本文整理汇总了PHP中Project::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::where方法的具体用法?PHP Project::where怎么用?PHP Project::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
public function search()
{
$q = Input::get('q');
if (isset($q) && !empty($q)) {
$search = $q;
return Project::where('title', 'like', $q)->orWhere('description', 'like', $q)->get();
}
}
示例2: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id_or_slug)
{
$obj = Project::find($id_or_slug);
if (is_object($obj)) {
return $obj;
} else {
return Project::where('slug', $id_or_slug)->first();
}
}
示例3: getCustomerProjects
public function getCustomerProjects()
{
$customer_id = Input::get('customer_id');
$projects = Project::where('customer_id', '=', $customer_id)->get();
foreach ($projects as $project) {
$project->rendered_html = $project->html();
}
return $projects;
}
示例4: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
if (Input::get('search') == null || Input::get('search') == '') {
$projects = Project::orderBy('created_at', 'DESC')->paginate(5);
} else {
$projects = Project::where('title', 'like', '%' . Input::get('search') . '%')->orderBy('projects.created_at', 'DESC')->paginate(5);
}
return View::make('admin/projects/index', compact('projects'));
}
示例5: setProject
/**
* Sets the project object on the class protected var $project
*
* @param object, pbject
*
* @return void || function()
*/
public function setProject($route, $request)
{
$project_name = $route->getParameter('project_name');
$project = Project::where('name', $project_name)->first();
if ($project != null) {
$this->project = $project;
} else {
return $this->getAPIMissing();
}
}
示例6: getIndex
/**
* Admin dashboard
*
*/
public function getIndex()
{
// Count how many projects are in each state
$application = Project::where('state', '=', 'Application')->count();
$available = Project::where('state', '=', 'Available')->count();
$inProgress = Project::where('state', '=', 'InProgress')->count();
$complete = Project::where('state', '=', 'Complete')->count();
$canceled = Project::where('state', '=', 'Canceled')->count();
$na = Project::where('state', '=', 'NA')->count();
$states = array('Application' => $application, 'Available' => $available, 'InProgress' => $inProgress, 'Complete' => $complete, 'Canceled' => $canceled, 'NA' => $na);
return View::make('admin/dashboard', compact('states'));
}
示例7: destroy
/**
* Remove the specified resource from storage.
* DELETE /users/{id}
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
// Delete everything related to the user
Task::where('user_id', Auth::id())->delete();
Credential::where('user_id', Auth::id())->delete();
Project::where('user_id', Auth::id())->delete();
Client::where('user_id', Auth::id())->delete();
User::where('id', Auth::id())->delete();
// Logout and redirect back to home page
Auth::logout();
return Redirect::to('/');
}
示例8: search
/**
* Run a general search.
* @return array of objects with the search results.
*/
public function search()
{
$q = Input::get("q");
// redirect user back if nothing was typed
if (empty(trim($q))) {
return Redirect::back();
}
$clients = Client::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
$projects = Project::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
$tasks = Task::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
$pTitle = "Search Results";
return View::make('search', compact('q', 'clients', 'projects', 'tasks', 'pTitle'));
}
示例9: userSection
function userSection()
{
$userId = Session::get('userId');
if (!isset($userId)) {
return Redirect::to('/');
}
$runningProjects = Project::where('status', '=', 'active')->count();
$closedProjects = Project::where('status', '=', 'closed')->count();
$currentBugs = Bug::where('status', '=', 'active')->count();
$fixedBugs = Bug::where('status', '=', 'fixed')->count();
$unresolvedBugs = Bug::where('status', '=', 'unresolved')->count();
$userBugs = BugUser::where('user_id', '=', $userId)->where('status', '=', 'active')->with('bug')->with('bug.project')->get();
return View::make('users.user-section')->with('runningProjects', $runningProjects)->with('closedProjects', $closedProjects)->with('currentBugs', $currentBugs)->with('fixedBugs', $fixedBugs)->with('unresolvedBugs', $unresolvedBugs)->with('userBugs', $userBugs);
}
示例10: showWelcome
public function showWelcome()
{
if (Auth::check()) {
$id = Auth::user()->id;
setlocale(LC_TIME, "fr_FR");
$today = date("Y-m-d");
$monday = date("Y-m-d", strtotime("previous monday"));
$sunday = date("Y-m-d", strtotime("next sunday"));
$projet = Project::where('user_id', '=', $id)->first();
$nbrProjet = count($projet);
$projectsList = Project::where('user_id', '=', $id)->get();
return View::make('accueil', array('date' => $today, 'projectsList' => $projectsList, 'nbrProjet' => $nbrProjet));
} else {
return Redirect::to('login');
}
}
示例11: form
public function form($slug)
{
// Retrive Project Details
$project = Project::where('slug', $slug)->first();
// Get all developer users
$developers = User::whereHas('roles', function ($q) {
$q->where('key', 'developer');
})->get();
// Get all QC users
$qc = User::whereHas('roles', function ($q) {
$q->where('key', 'qc');
})->get();
// Check if the project is existing.
if ($project) {
return View::make('projects.form')->with('project', $project)->with('developers', $developers)->with('qcs', $qc);
} else {
return Response::make('Unauthorized', 401);
}
}
示例12: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
if (Input::get('search') == null || Input::get('search') == '') {
$projects = Project::where('state', '=', 'Available')->orWhere('state', '=', 'InProgress')->orderBy('created_at', 'DESC')->paginate(5);
} else {
$projects = Project::join('tags', 'projects.id', '=', 'tags.project_id')->join('tag', 'tags.tag_id', '=', 'tag.id')->select('projects.*')->groupby('projects.id')->where(function ($query) {
$count = 0;
foreach (explode(', ', Input::get('search')) as $searchToken) {
if ($count == 1) {
$query->orWhere('tag.tag', 'like', '%' . strtolower($searchToken) . '%');
} else {
$query->where('tag.tag', 'like', '%' . strtolower($searchToken) . '%');
$count = 1;
}
}
})->where(function ($query) {
$query->where('state', '=', 'Available')->orWhere('state', '=', 'InProgress');
})->orderBy('projects.created_at', 'DESC')->paginate(5);
}
return View::make('site/project/index', compact('projects'));
}
示例13: getProjectTasks
public function getProjectTasks($projectId, $userId)
{
try {
$tresPass = \Projectcollabs::where('user_id', $userId)->where('project_id', $projectId)->get();
if (sizeof($tresPass) != 0) {
$tempuser = \Sentry::getUserProvider()->findById($userId);
$admin = \Sentry::getGroupProvider()->findByName('admin');
$manager = \Sentry::getGroupProvider()->findByName('manager');
$leader = \Sentry::getGroupProvider()->findByName('leader');
$user = \Sentry::getGroupProvider()->findByName('user');
if ($tempuser->inGroup($admin) or $tempuser->inGroup($manager) or $tempuser->inGroup($leader)) {
$tasks = \Task::where('project_id', $projectId)->get()->toArray();
$data = $this->makeTasks($tasks);
$projectslist = \Projectcollabs::where('user_id', $userId)->lists('project_id');
$projects = \Project::whereIn('id', $projectslist)->orderBy('project_name')->get(array('id', 'project_name'))->toArray();
$data['projects'] = $projects;
$data['name_proj'] = \Project::where('id', $projectId)->pluck('project_name');
return $data;
} elseif ($tempuser->inGroup($user)) {
$tasksId = \Taskcollabs::where('user_id', $userId)->lists('task_id');
$tasks = \Task::whereIn('id', $tasksId)->where('project_id', $projectId)->get()->toArray();
$data = $this->makeTasks($tasks);
$projectslist = \Projectcollabs::where('user_id', $userId)->lists('project_id');
$projects = \Project::whereIn('id', $projectslist)->orderBy('project_name')->get(array('id', 'project_name'))->toArray();
$data['projects'] = $projects;
$data['name_proj'] = \Project::where('id', $projectId)->pluck('project_name');
return $data;
}
} else {
throw new \NotAuthorizedForProject();
}
} catch (\NotAuthorizedForProject $e) {
throw new \NotAuthorizedForProject();
} catch (Exception $e) {
\Log::error('Something Went Wrong in Task Repository - getProjectTasks():' . $e->getMessage());
throw new SomeThingWentWrongException();
}
}
示例14: store
/**
* [store - jira weebhook handler]
* @return [void] []
*/
public function store()
{
$post_data = file_get_contents("php://input");
mail('andre@eenvoudmedia.nl', 'jira_posted_data', $post_data);
$reply = json_decode($post_data);
$status_id = $reply->issue->fields->status->id;
//error_log('status_id: '.$status_id);
if ($status_id === Config::get('eenvoudcrm.jira_status_closed') || $status_id === Config::get('eenvoudcrm.jira_status_done')) {
mail('andre@eenvoudmedia.nl', 'jira_new_worklog', $post_data);
$worklog = new Werklog();
$worklog->description = 'Issue ' . $reply->issue->id . ' - ' . $reply->issue->fields->summary;
$worklog->minutes = (int) $reply->issue->fields->timetracking->timeSpentSeconds / 60.0;
$worklog->date = date("Y-m-d");
$worklog->billable = 1;
$jira_username = $reply->user->name;
$user = User::whereRaw("username like '%" . $jira_username . "%'")->first();
if ($user) {
$worklog->user_id = $user->id;
} else {
$worklog->user_id = Config::get('eenvoudcrm.default_user_id');
}
$jira_id = $reply->issue->fields->project->id;
$project = Project::where('jira_id', '=', $jira_id)->first();
if ($project) {
$worklog->company_id = $project->company_id;
$worklog->project_id = $project->id;
} else {
$worklog->company_id = Config::get('eenvoudcrm.default_company_id');
$worklog->project_id = Config::get('eenvoudcrm.default_project_id');
}
try {
$worklog->save();
} catch (Exception $e) {
error_log(json_encode($e));
}
}
}
示例15: iCopiedThePhabricatorId
/**
* @Given I copied the :project :sprint Phabricator ID
*/
public function iCopiedThePhabricatorId($project, $sprint)
{
$this->phabricatorProjectID = Sprint::where('title', $sprint)->where('project_id', Project::where('title', $project)->first()->id)->first()->phabricator_id;
}