public function showDashboard()
 {
     $projects = new Project();
     $projectCount = $projects->count();
     $published = $projects->where('published', 1)->count();
     $unpublished = $projects->where('published', 0)->count();
     $illustrations = Illustration::count();
     $logos = Logo::count();
     return view('dashboard/dashboard', compact('projectCount', 'published', 'unpublished', 'illustrations', 'logos'));
 }
 public function show()
 {
     $title = Input::get('title');
     $projects = Project::where('title', 'LIKE', '%' . $title . '%')->get();
     $data = array('projects' => $projects, 'users' => User::all());
     return view('projectresult', $data);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Requests\BeneficiatyCreateRequest $request)
 {
     $proyecto = Project::find($request->get('project_id'));
     if ($proyecto == null) {
         return redirect()->back()->with('errors', 'El proyecto no existe');
     }
     $homes = Beneficiary::where('project_id', '=', $proyecto->id)->get();
     if (count($homes) >= $proyecto->quantity) {
         Session::flash('message', 'Este proyecto tiene el maximo numero de beneficiarios');
         return redirect()->to('admin/proyectos');
     } else {
         $beneficiario = Beneficiary::create($request->all());
         $beneficiario->birthdate = Carbon::parse($request->get('birthdate'));
         $beneficiario->save();
         $etapas_project = Project::where('projects.id', '=', $proyecto->id)->join('designs', 'designs.id', '=', 'projects.desing_id')->join('desing_stage', 'desing_stage.desing_id', '=', 'designs.id')->join('stages', 'stages.id', '=', 'desing_stage.stage_id')->join('activity_stage', 'activity_stage.stage_id', '=', 'stages.id')->join('activities', 'activities.id', '=', 'activity_stage.activity_id')->groupBy('activities.id')->get(['activities.id as id']);
         foreach ($etapas_project as $e) {
             $avance = new Advanced();
             $avance->porcent = 0.0;
             $avance->state = 4;
             $avance->beneficiary_id = $beneficiario->id;
             $avance->save();
             $avance->actividades()->attach($e->id);
         }
         Session::flash('message', 'Beneficiario creado de forma correcta');
         return redirect()->to('admin/beneficiarios');
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $tags = Tag::where('user_id', Auth::user()->id)->orderBy('created_at', 'asc')->get();
     $projects = Project::where('user_id', Auth::user()->id)->orderBy('created_at', 'asc')->get();
     return view('portfolioAdmin', ['tags' => $tags, 'projects' => $projects]);
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     Route::bind('slug', function ($value) {
         return Project::where('slug', '=', $value)->firstOrFail();
     });
     parent::boot($router);
 }
Example #6
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(ProjectUpdateRequest $request, $id)
 {
     $project = new Project($request->all());
     Project::where('id', $id)->update($project->getAttributes());
     flash()->success(trans('project.label.name'), trans('project.message_alert.update_success'));
     return redirect('/projects');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  * Request $request, $id
  */
 public function update()
 {
     $id = Request::get('pid');
     $inp = Request::get('project');
     Project::where('id', $id)->update(['project' => $inp]);
     return redirect('project');
 }
 public function show($name)
 {
     if (\Auth::check() && \Auth::user()->permission->name == 'admin') {
         if (is_numeric($name)) {
             $p = Project::where('id', '=', $name)->where('trash', '=', '0')->first();
             if (is_null($p)) {
                 return \Redirect::to('404');
             }
             return \View::make('projects.show')->with('entry', $p);
         } else {
             $p = Project::where('name', '=', $name)->where('trash', '=', '0')->first();
             if (is_null($p)) {
                 return \Redirect::to('404');
             }
             return \View::make('projects.show')->with('entry', $p);
         }
     } else {
         if (is_numeric($name)) {
             $p = Project::where('id', '=', $name)->where('trash', '=', '0')->where('state', '=', '1')->first();
             if (is_null($p)) {
                 return \Redirect::to('404');
             }
             return \View::make('projects.show')->with('entry', $p);
         } else {
             $p = Project::where('name', '=', $name)->where('trash', '=', '0')->where('state', '=', '1')->first();
             if (is_null($p)) {
                 return \Redirect::to('404');
             }
             return \View::make('projects.show')->with('entry', $p);
         }
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $project = Project::where('id', $id)->get()->first();
     if (!$project) {
         return Response::json(['message' => 'Project not found'], 404);
     }
     return Response::json($project);
 }
Example #10
0
 /**
  * reads Project table by unique index
  *  - if not found, emit a not found message.
  *  - if found return the $project record to the caller.
  *
  * @param [in] $text
  * @return a record.
  */
 public static function checkIfExists($text)
 {
     $project = Project::where('name', '=', $text)->first();
     if (!is_null($project)) {
         appGlobals::existsMessage(appGlobals::getProjectTableName(), $project->name, $project->id);
     }
     return $project;
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $modules = Module::where('project_id', '=', $_GET)->get();
     $existing_modules_count = Module::where('project_id', '=', $_GET)->count();
     $projected_modules = Project::where('id', '=', $_GET)->pluck('projected_total_modules');
     $modules_count = $projected_modules - $existing_modules_count;
     return view('modules.index', compact('modules', 'modules_count'));
 }
Example #12
0
 public function projectList()
 {
     $projects_member_id = Member::where("Developer_id", auth()->User()->id)->get()->pluck("project_id");
     $project_owner_id = Project::where("developer_id", auth()->User()->id)->get()->pluck("id");
     $projects_id = array_merge($projects_member_id->toArray(), $project_owner_id->toArray());
     $project = Project::whereIn("id", $projects_id)->get();
     $developer = DB::table('Developer')->get();
     return view("project.list")->with('project', $project)->with('developer', $developer);
 }
 /**
  * 取得給定使用者name的所有project include tags。
  *
  * @param  String $name
  * @return Collection
  */
 public function getProjectsByName($name)
 {
     $user = User::where('name', $name)->first();
     if ($user == null) {
         return null;
     }
     $projects = Project::where('user_id', $user->id)->get();
     return $projects;
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer('layouts.app', function ($view) {
         $production = \App\Project::where('status_id', 1)->get();
         $design = \App\Project::where('status_id', 2)->get();
         $prospect = \App\Project::where('status_id', 3)->get();
         $view->with(compact('production', 'design', 'prospect'));
     });
 }
 public function renderHome()
 {
     $first_featured = Project::where('featured_pos', 1)->first();
     $second_featured = Project::where('featured_pos', 2)->first();
     $third_featured = Project::where('featured_pos', 3)->first();
     $fourth_featured = Project::where('featured_pos', 4)->first();
     $fifth_featured = Project::where('featured_pos', 5)->first();
     return view('home', ['first_featured' => $first_featured, 'second_featured' => $second_featured, 'third_featured' => $third_featured, 'fourth_featured' => $fourth_featured, 'fifth_featured' => $fifth_featured]);
 }
 /**
  * Display a listing of all manageable projects.
  *
  * @return \Illuminate\View\View
  */
 public function manageProjectIndex(Request $request)
 {
     // If request is a search
     if ($request->method() === "PUT") {
         $projects = Project::where('name', 'LIKE', '%' . $request->search . '%')->get();
     } else {
         $projects = Project::all();
     }
     return view('admin.project.index', ['projects' => $projects]);
 }
 public function MiProyecto($id_user)
 {
     if (\Gate::denies('my-project', $id_user)) {
         $mensaje = "Acceso no autorizado, tu solo puedes acceder a tu proyecto";
         \Session::flash('alerta', $mensaje);
         return redirect()->route('estudiante.index');
     }
     $project = Project::where('id_user', $id_user)->first();
     return view('estudianteviews.miproyecto', compact('project'));
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $locations = Location::all()->lists('project_id');
     $project_list = Project::where('id', '>', '1');
     foreach ($locations as $location) {
         $project_list = $project_list->where('id', '!=', $location);
     }
     $project_list = $project_list->lists('name', 'id')->toArray();
     return view('pages.add-location', compact('project_list'));
 }
Example #19
0
 public function ByCategory($id)
 {
     $data = ['active1' => Project::findOrFail(1), 'active2' => Project::findOrFail(2), 'active3' => Project::findOrFail(3), 'categories' => Category::all(), 'id' => $id];
     if ($id == 0) {
         $project = Project::all();
     } else {
         $project = Project::where('category_id', '=', $id)->get();
     }
     return view('project.ByCategory', compact('project'))->with($data);
 }
 public function delete($id)
 {
     $entry = Project::find($id);
     if (isset($entry)) {
         Project::where('id', $id)->update(array('trash' => 1));
         return \Redirect::route('project', array($id))->with('success', $entry->title . ' deleted successfully!');
     } else {
         return \Redirect::route('project', array($id))->with('error', 'Failed to delete, invalid credentials.');
     }
 }
Example #21
0
 private function findProjects()
 {
     $projects = Project::where('category', Auth::user()->freelancer->category)->orderBy('updated_at', 'desc')->get();
     foreach ($projects as $project) {
         if (Decision::where('project_id', $project->id)->where('freelancer_id', Auth::user()->freelancer->id)->where('decision', 0)->exists() || Decision::where('project_id', $project->id)->where('freelancer_id', Auth::user()->freelancer->id)->where('user_id', Auth::id())->exists() || Match::where('project_id', $project->id)->where('freelancer_id', Auth::user()->freelancer->id)->exists()) {
             continue;
         }
         return $project;
     }
     return null;
 }
Example #22
0
 public function destroy($id)
 {
     $user = User::find($id);
     $projects = Project::where('user_id', $id);
     foreach ($projects as $project) {
         $project->users()->detach($user_id);
         $project->save();
     }
     $user->Delete('set null');
     flash()->success('User account has been successfully deleted!');
     return redirect()->action('UsersController@index');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|string', 'department_id' => 'required|numeric']);
     $duplicate = Project::where('name', $request->name)->where('department_id', $request->department_id)->first();
     if ($duplicate) {
         return response()->json(true);
     }
     $project = new Project();
     $project->name = $request->name;
     $project->department_id = $request->department_id;
     $project->save();
 }
 /**
  * Display the specified resource.
  *
  * @param  string  $name
  * @return Response
  */
 public function show($name)
 {
     $project = Project::where('name', $name)->get()->first();
     $x = new Filesystem();
     $filesDestination = File::allfiles($_SERVER['DOCUMENT_ROOT'] . '/uploads/' . $name);
     $files = array();
     for ($c = 0; $c < count($filesDestination); $c++) {
         $files[$c] = File::name($filesDestination[$c]) . '.' . File::extension($filesDestination[$c]);
     }
     //dd($filenames);
     return view('project.show', compact('project', 'files'));
 }
Example #25
0
 /**
  * Generate Project Associate Array
  *
  * @return Array
  */
 public static function all_select($show_all = '')
 {
     $_ret = array();
     $_ret[''] = '-- project --';
     if ($show_all == 'all') {
         $_ret[1] = '** ALL **';
     }
     $projects = \App\Project::where('id', '>', 1)->orderBy('name')->get();
     foreach ($projects as $project) {
         $_ret[$project->id] = $project->name;
     }
     return $_ret;
 }
Example #26
0
 /**
  * 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'));
 }
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     // bind skill, course, and project wildcards the the alias in the database.
     $router->bind('skill', function ($alias) {
         return Skill::where('alias', $alias)->firstOrFail();
     });
     $router->bind('course', function ($alias) {
         return Course::where('alias', $alias)->firstOrFail();
     });
     $router->bind('project', function ($alias) {
         return Project::where('alias', $alias)->firstOrFail();
     });
 }
 public function changeFeatured(Request $request)
 {
     $input = Input::all();
     $project_id = $input['project_id'];
     $featured_pos = $input['featured_pos'];
     $current_project = Project::where('featured_pos', $featured_pos);
     $new_project = Project::findOrFail($project_id);
     if ($new_project->featured_pos !== 0) {
         $current_project->update(['featured_pos' => $new_project->featured_pos]);
     }
     $new_project->update($input);
     $new_project->save();
     return redirect('/admin');
 }
Example #29
0
 /**
  * Show the Administrator panel.
  *
  * @return \Illuminate\View\View
  */
 public function index()
 {
     try {
         $user = Auth::user()->with('projects')->where('id', '=', '2')->firstOrFail();
     } catch (ModelNotFoundException $e) {
         return Redirect::home();
     }
     // if it's admin, redirect to admin cms with all users but admin
     $allUsers = User::whereNotIn('id', [2])->get();
     $allSponsors = Sponsor::all();
     // Retrieve all projects pending approval.
     $pendingProjects = Project::where('approved', '=', '0')->where('application_status', '=', '1')->where('live', '=', '0')->get();
     return view('adminpanel.index', compact('user', 'allUsers', 'pendingProjects', 'allSponsors'));
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function consulta(Request $request)
 {
     $proyecto_etapa = Project::where('projects.id', '=', $request->get('project_id'))->join('project_stage', 'project_stage.project_id', '=', 'projects.id')->join('stages', 'stages.id', '=', 'project_stage.stage_id')->where('stages.id', '=', $request->get('stage_id'))->get(['project_stage.id as id', 'stages.name as name']);
     $actividad_etapa = Activity_Stage::where('activity_id', '=', $request->get('activity_id'))->where('stage_project_id', '=', $proyecto_etapa->last()->id)->get();
     if (count($actividad_etapa) > 0) {
         $especificaciones = Spacification::where('activity_id', '=', $actividad_etapa->last()->id)->get();
     } else {
         $especificaciones = '';
     }
     $etapa = stage::where('id', '=', $request->get('stage_id'))->first();
     $proyecto = Project::where('id', '=', $request->get('project_id'))->first();
     $actividad = Activity::where('id', '=', $request->get('activity_id'))->first();
     return response()->json(['actividad_etapa' => $actividad_etapa, 'etapa' => $etapa->name, 'especificaciones' => $especificaciones, 'proyecto' => $proyecto->name, 'actividad' => $actividad->name, 'project_id' => $proyecto->id, 'stage_id' => $etapa->id, 'activity_id' => $actividad->id, 'project_stage_id' => $proyecto_etapa->first()->id]);
 }