Example #1
0
 public function create(Project $project)
 {
     $projects = Project::get();
     //sends an array of  'first_name' => 'id'
     $subs = Sub::where('employee', '=', 1)->lists('first_name', 'id');
     //where 'employee refers to if they're a GS employee..not an ID
     //$clients = Client::lists('first_name', 'id'); //sends an array of  'first_name' => 'id'
     return view('hours.create', compact('projects', 'subs'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $project = Project::get();
     return $project;
     // return response([ 'error' => false, 'data' => $project], 200);
 }
 public function index()
 {
     // \Auth::user()->name; //get name of Auth user
     $projects = Project::get();
     return view('projects.index', compact('projects', 'expenses'));
 }
Example #4
0
 public function addProjects(StoreProjectDetailsRequest $request)
 {
     //Add new project to the database
     $owner = $request->owner;
     $users = User::where("name", $owner)->get();
     //Verifying the user_id of the project owner
     $user_id = $users[0]->id;
     $project_name = $request->project_name;
     $description = $request->description;
     $technologies = $request->technologies;
     $deadline = $request->deadline;
     $project = new Project();
     $project->user_id = $user_id;
     $project->name = $project_name;
     $project->description = $description;
     $project->technologies = $technologies;
     $project->deadline = $deadline;
     $project->save();
     //Save data to the "project" table
     //Display added projects
     $user = Auth::user();
     $type = $user->type;
     $name = $user->name;
     $project = Project::get();
     //Get all the projects from the Projects table
     $reservation = Reservations::where('user', $name)->get();
     //Get reserved projects
     $reserved = array();
     //Create array to store reserved project ids
     foreach ($reservation as $res) {
         array_push($reserved, $res->project_id);
         //Save each reserved project id to the array
     }
     $projectR = Project::whereNotIn('id', $reserved)->get();
     //Get projects which are not reserved
     $volunteer = Volunteers::where('user', $name)->get();
     //Get volunteered projects
     $volunteered = array();
     //Create array to store volunteered project ids
     foreach ($volunteer as $vol) {
         array_push($volunteered, $vol->project_id);
         //Save each volunteered project id to the array
     }
     $projectV = Project::whereNotIn('id', $volunteered)->get();
     //Get projects which are not volunteered
     $finalizedProject = FinalizedProjects::where('user', $name)->get();
     //Get finalized project
     $finalized_pn = "";
     if (sizeof($finalizedProject) != 0) {
         $finalized_pn = $finalizedProject[0]->project_name;
     }
     if ($type == "lecturer") {
         return view('pages.ViewProjectsLecturer', compact('projectV', 'volunteer'));
         //Return the web page to view projects for a lecturer
     } elseif ($type == "student") {
         return view('pages.ViewProjectsStudent', compact('projectR', 'reservation', 'finalized_pn'));
         //Return the web page to view projects for a student
     } elseif ($type == "coordinato") {
         return view('pages.ViewProjects', compact('project'));
         //Return the web page to view projects for the coordinator
     }
 }
 public function edit(Expense $expense)
 {
     $projects = Project::get();
     $subs = Sub::lists('company_name', 'id');
     return view('expenses.edit', compact('projects', 'subs', 'expense'));
 }