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); }
/** * 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')); }
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); }
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; } }
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(); }
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); }
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'); }
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; }
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()]); }
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; }
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]); } }
/** * 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; }
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]); }
private function check_repeat($projects_name) { $project = Project::where('projects_name', $projects_name)->count(); if ($project) { return true; } }
| 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'); }); /* |--------------------------------------------------------------------------
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize(Request $request) { $id = $request['id']; return Project::where('id', $id)->where('user_id', Auth::id())->exists(); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $input = Request::all(); $input['user_id'] = Auth::User()->id; $validation = Project::validateUpdate($input, $id); if ($validation->fails()) { $message = $validation->messages()->first(); return Response()->json(ResponseManager::getError('', 10, $message)); } if (array_key_exists('users', $input)) { foreach ($input['users'] as $user) { $data = ['project_id' => $id, 'user_id' => $user['id']]; $chkExist = ProjectUser::where('project_id', $id)->where('user_id', $user['id'])->count(); if ($chkExist == 0) { ProjectUser::create($data); $email['email'] = $user['email']; $email['user'] = $user['name']; $email['msg'] = $input['message']; $email['pname'] = $input['name']; $email['code'] = base64_encode($email['email'] . '-' . $id); Mail::send('emails.invite', $email, function ($message) use($email) { $message->to($email['email'])->subject(Auth::User()->name . ' want to add you to ' . $email['pname']); }); } } } unset($input['users']); unset($input['message']); $project = Project::where('id', $id)->update($input); if ($project) { $message = 'update Successfully.'; return Response()->json(ResponseManager::getResult($project, 10, $message)); } else { $message = 'Something went wrong. Please try again.'; return Response()->json(ResponseManager::getError('', 10, $message)); } }
public function search() { $input = Input::all(); $data['q'] = $input['q']; $perms = array_flatten(Permission::where('user_id', '=', Auth::user()->id)->select('society_id')->get()->toArray()); $individuals = Individual::where('surname', 'like', '%' . $input['q'] . '%')->orWhere('firstname', 'like', '%' . $input['q'] . '%')->whereNull('deleted_at')->orderBy('surname')->get(); foreach ($individuals as $indiv) { if ($indiv->household) { if (in_array($indiv->household->society_id, $perms)) { $ids[] = $indiv->id; } } } $data['individuals'] = Individual::wherein('id', $ids)->get(); $data['groups'] = Group::where('groupname', 'like', '%' . $input['q'] . '%')->whereIn('society_id', $perms)->whereNull('deleted_at')->get(); $data['projects'] = Project::where('project', 'like', '%' . $input['q'] . '%')->whereNull('deleted_at')->get(); return view('home', $data); }
public function getChangefeastat($projectid, $projectstatus) { $project = Project::find($projectid); if ($projectstatus == 1) { $project_genre_id = $project->project_genre_id; $affectedRows = Project::where('project_genre_id', $project_genre_id)->where('featured', '1')->update(['featured' => 0]); $project->featured = $projectstatus; if ($project->save()) { \Request::session()->flash('alert-success', 'Staff Pick has been set successfully.'); return response(['msg' => 'Action Updated', 'status' => 'OK']); } else { return response(['msg' => 'Action Updated', 'status' => 'FAILED']); } } else { $project->featured = $projectstatus; if ($project->save()) { \Request::session()->flash('alert-success', 'Staff Pick has been unset successfully.'); return response(['msg' => 'Action Updated', 'status' => 'OK']); } else { return response(['msg' => 'Action Updated', 'status' => 'FAILED']); } } }
public function contract_parts($id) { $conType = "General Terms Agreement"; $atas = Ata::where('active', 1)->get(); $project = Project::where('id', $id)->first(); $company = $project->company; $adc = ConsortiumGlobal::where('id', '1')->first(); return view('workscopes.listing', compact('conType', 'atas', 'company', 'project', 'adc')); }
public function listByProject($projectID) { $project = Project::where('id', $projectID)->first(); $tickets = []; return view('tickets.list', compact('project', 'tickets')); }
/** * Update the specified project in database. * * @param Request $request * @return Response */ public function update(UpdateProjectRequest $request) { $project = Project::where('id', $request['id'])->first(); $project->update($request->all()); return redirect()->route('{user}.project.show', ['user' => Auth::user()->username, 'project' => $project->name])->with(['project' => $project]); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $data['organisation'] = Organisation::find($id); $data['projects'] = Project::where('organisation_id', '=', $data['organisation']->id)->get(); return view('organisations.show', $data); }
public function postRefund(Request $request) { $transaction_id = $request->get('id'); $error = ''; $transaction_details = \App\Models\ProjectFund::findOrFail($transaction_id); $getProjectReceiverAccount = \App\Models\Project::where('id', $transaction_details->P_ID)->first(); $getReceiverAccount = $getProjectReceiverAccount->user_id ? \App\Models\ReciverAccount::where('user_id', $getProjectReceiverAccount->user_id)->first() : Null; //dd($getReceiverAccount->secret_key); if ($getReceiverAccount->secret_key) { \Stripe\Stripe::setApiKey($getReceiverAccount->secret_key); } try { $paid_amount = $transaction_details->paid_amount * 100; $refund = \Stripe\Refund::create(array('amount' => $paid_amount, 'charge' => $transaction_details->transaction_id)); //dd($refund->toArray()); //updatating local table $cashWithDrawaldRequest = new \App\Models\CashWithdrawalsRequest(); $cashWithDrawaldRequest->user_id = $getProjectReceiverAccount->user_id; $cashWithDrawaldRequest->status = 'request'; $cashWithDrawaldRequest->project_fund_id = $transaction_id; if ($cashWithDrawaldRequest->save()) { $request->session()->flash('alert-success', 'Request for charge refunding is successfully posted . '); //return response(['msg' => 'success' ]); return \Redirect::to('home/project-backed')->with('msg', 'success'); } else { $request->session()->flash('alert-success', 'Request for charge refunding is not processed !'); //return response(['msg' => 'failure' ]); return \Redirect::to('home/project-backed')->with('stripe_errors', $error['message']); } ///update } catch (Exception $e) { // dd("a"); $e_json = $e->getMessage(); $error = $e_json['error']; return response(['msg' => 'failure']); //return \Redirect::to('home/project-backed')->with('stripe_errors',$error['message']) ; } //dd($refund->_lastResponse); }
public function getFollowingProjects($id = Null) { if ($id == Null) { \App::abort(404, 'Invalid User Id'); } else { $user_id = $id; } $followingProjectLists = array(); $lists = \App\Models\ProjectFollowers::where('user_id', $user_id)->orderBy('created_at', 'desc')->get(); if (count($lists) > 0) { foreach ($lists as $val) { $followingProjectLists[] = $val->project_id; } } $result = array_unique($followingProjectLists); $myFollowingProjectLists = Project::where('active', '1')->whereIn('id', $result)->orderBy('created_at', 'desc')->get(); return view('user.following-projects', ['_menus' => $this->menuItems, 'login_url' => $this->login_url, 'user' => \App\User::where('id', $user_id)->first(), 'dashBoardDetailsByAuthUser' => $this->userrepo->generalOverViewByAuthUser($user_id), 'my_following_projects' => $this->project_repo->prepareListObj($myFollowingProjectLists)]); }
protected function getProject() { return Project::where('userId', Auth::user()->id)->get(); }