public function make(Request $request)
 {
     if (!$request->has('title') || !$request->has('description') || !$request->has('noOfPeople') || !$request->has('noOfDays') || !$request->has('budget') || !$request->has('start_date') || !$request->has('end_date')) {
         return view('error')->with('error', 'Please provide all the fields.');
     }
     $task = new \App\Task();
     $input = $request->all();
     $task->employer_id = \Auth::id();
     $task->title = $input['title'];
     $task->description = $input['description'];
     $task->noOfPeople = $input['noOfPeople'];
     $task->noOfDays = $input['noOfDays'];
     $task->budget = $input['budget'];
     $task->start_date = $input['start_date'];
     $task->end_date = $input['end_date'];
     $task->preferred_gender = $input['preferred_gender'];
     $task->workFromHome = $input['workFromHome'];
     if (isset($input['min_age'])) {
         $task->min_age = $input['min_age'];
     }
     if (isset($input['max_age'])) {
         $task->max_age = $input['max_age'];
     }
     $task->save();
     // return response()->json(['success' => $task->id]);
     return redirect('/tasks');
 }
Beispiel #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $tasks = [['title' => 'Garbage', 'slug' => 'garbage', 'reminder_time' => null, 'reminder_day' => null, 'timing' => 'daily', 'description' => "<li>Check the main kitchen garbage once a day.</li> " . "<li>If full, take the garbage out of the office immediately. Bring the garbage bag to the end of the corridor on the first floor near the men's washroom. The building will clear this area.</li>" . "<li>Every friday end of day, take out the garbage regardless of \"fullness\" level. This is to avoid odors building up over the weekend, especially in summer months.</li>" . "<li>Coordinate with the Fridge Cleaning task at the end of the week, and the Kitchen Supplies task if you run low on bags.</li>"], ['title' => 'Clean Small Kitchen Applicances', 'slug' => 'appliances', 'reminder_time' => null, 'reminder_day' => null, 'timing' => 'daily', 'description' => "<li>Clean the coffee machines every couple days. This involves WASHING all removable parts thoroughly and cleaning the machine itself with a rag or scott towel.</li> " . "<li>Please be careful with your choice of cleaning products and the quality of the rinsing as this may end up in someone's drink.</li>" . "<li>Clean the toaster oven once a week. If needed, change the aluminium foil at the bottom. Empty out all crumbs and scrub anything which has melted into the machine.</li>" . "<li>Clean the kettle once a week.</li>" . "<li>Wipe down the microwave inside and out.</li>"], ['title' => 'Clean and Clear the Boardroom', 'slug' => 'boardroom', 'reminder_time' => null, 'reminder_day' => null, 'timing' => 'daily', 'description' => "<li>Remove any items left behind after a meeting. The table should be clear of everything except the keyboard, mouse and conference phone.</li> " . "<li>Clean the surface of the table as needed. You may use the cleaning wipes kept in the kitchen area.</li>" . "<li>Return all chairs in their respective places, especially after the cleaners have come through.</li>" . "<li>Close down any programs which were used on the Mac Mini. Turn the TV off if it was left on.</li>" . "<li>Clean off the whiteboard if it was used. Check to make sure the information isn’t needed first if the meeting just ended.</li>"], ['title' => 'Empty the Dishwasher', 'slug' => 'dishes', 'reminder_time' => null, 'reminder_day' => null, 'timing' => 'daily', 'description' => "<li>Empty the dishwasher as soon as possible when you arrive in the morning.</li>"], ['title' => 'Empty the fridge', 'slug' => 'empty-fridge', 'reminder_time' => null, 'reminder_day' => null, 'timing' => 'Th Fr', 'description' => "<li>Toss all abandoned food, especially take-out containers.</li>" . "<li>Toss any empty containers (juice, etc..)</li>" . "<li>Check all other food items for expiry dates, toss anything which looks questionable.</li>" . "<li>Clean up any spills, especially in the door where most spills happen.</li>" . "<li>Move items around to make space for next week.</li>" . "<li>Any rotten food in a reusable container is to be tossed immediately, do not open it, this is not your responsibility.</li>"], ['title' => 'Water the plants', 'slug' => 'plants', 'reminder_time' => null, 'reminder_day' => null, 'timing' => 'twice a week', 'description' => "<li>Fill the green watering can with cold water and water every plant in the office.</li> " . "<li>Check every desk and corner of the office for small plants.</li>" . "<li>During the summer months, this must be done twice a week. For winter months, once a week is acceptable."], ['title' => 'Recycling', 'slug' => 'recycling', 'reminder_time' => null, 'reminder_day' => null, 'timing' => 'we', 'description' => "<li>Collect all recycling from the kitchen, keeping the \"returnables\" (soda cans, beer bottles = things worth money when returned) separate from the regular recycling.</li> " . "<li>Replace the bags, which are stored underneath the sink.</li>" . "<li>Empty all personal recycling bins found at each island. When possible, continue to separate the \"returnables\" from the paper, etc.." . "<li>Empty all shedder bins.</li>" . "<li>Be sure to check for random shipping boxes which were abandoned throughout the office. Make sure they don't contain anything important.</li>" . "<li>Bring all recycling you've collected down to street level on Ste Catherine. Pile them with the other recycling from other units (ex: Pharmaprix).</li>"], ['title' => 'Restock the fridge', 'slug' => 'restock-fridge', 'reminder_time' => null, 'reminder_day' => null, 'timing' => 'daily', 'description' => "<li>Keep a constant stock of all different types of drinks provided by Plank.</li> " . "<li>Coordinate with Steve or Colin once drinks stocks are low to have more ordered at their discretion.</li>" . "<li>Restocking should happen every morning in the summer months, and every couple days in the winter months."], ['title' => 'Clean and Clear the Sink', 'slug' => 'sink', 'reminder_time' => null, 'reminder_day' => null, 'timing' => 'daily', 'description' => "<li>Fill the dishwasher with any dishes left in the sink.</li> " . "<li>Once a week, wash the sink down with cleaning products or dish soap.</li>"], ['title' => 'Kitchen Counters', 'slug' => 'surfaces', 'reminder_time' => null, 'reminder_day' => null, 'timing' => 'daily', 'description' => "<li>Wipe down all counters in the kitchen. This includes the coffee station, and the kitchen table.</li> " . "<li>Should be done once a day. Most important around 1pm after everyone has finished lunch.</li>"], ['title' => 'Coffee & Cleaning supplies', 'slug' => 'supplies', 'reminder_time' => null, 'reminder_day' => null, 'timing' => 'daily', 'description' => "Colin will take care of any supply ordering which would come from Staples, example: paper supplies, printer ink toner, pens, pencils and so on.<br> " . "This task involves replenishing all stock related to the kitchen and is usually purchased from Pharmaprix downstairs.<br>" . "The office should maintain an abundance of the following items:<br>" . "<li>Coffee, ground (Melitta Traditional Premium Roast)</li>" . "<li>Milk (Skim, 2%, and Cream)</li>" . "<li>Blue recycling bags</li>" . "<li>Garbage bags (for the kitchen, 83L bags)</li>" . "<li>Kleenex boxes</li>" . "<li>Scott towels</li>" . "<li>Dish soap</li>" . "<li>Hand soap</li>" . "<li>Pads for the dish cleaning tool</li>" . "<li>Disinfectant wipes</li>" . "Buy these items as often as needed to keep a constant stock in the office. You are expected to pay for these items yourself. Keep your receipts and provide them to Colin for a full reimbursement. Place the receipts in the orange folder on Colin’s desk."]];
     foreach ($tasks as $str_task) {
         $task = new App\Task($str_task);
         $task->save();
     }
 }
Beispiel #3
0
 /**
  * Create fake task
  *
  * @return \App\Task
  */
 private function createFakeTask()
 {
     $faker = Faker\Factory::create();
     $task = new \App\Task();
     $task->name = $faker->sentence;
     $task->done = $faker->boolean;
     $task->priority = $faker->randomDigit;
     $task->save();
     return $task;
 }
Beispiel #4
0
 /**
  * Responds to requests to POST /tasks/add
  */
 public function postAddTask(Request $request)
 {
     $this->validate($request, ['description' => 'required|min:4', 'due' => 'required|integer|min:1']);
     $newtask = new \App\Task();
     $user = \Auth::user();
     $newtask->description = $request->description;
     $newtask->due = Carbon::now()->addDays($request->due);
     $newtask->save();
     $user->tasks()->save($newtask);
     \Session::flash('flash_message', 'Successfully added new task!');
     return redirect('/tasks');
 }
 public function create(Request $request)
 {
     $inputs = $request->only('name');
     if ($inputs['name'] == null) {
         return redirect('/');
     }
     $task = new \App\Task();
     $task->name = $inputs['name'];
     $task->is_complete = false;
     $task->save();
     return redirect('/');
 }
Beispiel #6
0
 public function postCreate(Request $request)
 {
     $this->validate($request, ['description' => 'required|max:500', 'year' => 'required', 'month' => 'required', 'day' => 'required']);
     $project_id = $request->project_id;
     $year = $request->year;
     $month = $request->month;
     $day = $request->day;
     $task = new \App\Task();
     $task->project_id = $project_id;
     $task->description = $request->description;
     $task->due_date = Carbon::createFromDate($year, $month, $day);
     $task->save();
     \Session::flash('flash_message', 'Your task was added!');
     return \Redirect::action('TasksController@getShow', array($project_id));
 }
Beispiel #7
0
 public function create()
 {
     $this->_methodName = 'create';
     $this->resolveParams();
     if ($this->checkAuth() && !Auth::checkAdmin()) {
         throw new \App\Exceptions\ExceptionApiMethodbad($this->_typeName, $this->_methodName, $this->_request_params);
     }
     $arNeed = ['name' => 'required', 'description' => 'required', 'score' => 'required|numeric', 'timer' => 'required', 'userAvailable' => 'required_without:userAll', 'userAll' => 'required_without:userAvailable|in:true,false'];
     $this->checkAttr($arNeed);
     $this->checkAuth();
     $this->checkAuthAdmin();
     $task = new \App\Task();
     $task->name = $this->_request_params['name'];
     $task->description = $this->_request_params['description'];
     $task->point = $this->_request_params['score'];
     $task->timer = $this->_request_params['timer'];
     $task->save();
     if (!isset($this->_request_params['userAvailable'])) {
         $users = \App\Users::all();
     } else {
         $userArray = explode(';', $this->_request_params['userAvailable']);
         $users = \App\Users::whereIn('id', $userArray)->get();
     }
     foreach ($users as $user) {
         $task_user = new \App\UserTask();
         $task_user->id_task = $task->id;
         $task_user->id_user = $user->id;
         $task_user->status = 'available';
         $task_user->save();
         $users_array[] = $user->email;
     }
     $MESSAGE = 'Added new task';
     $url = 'https://api.parse.com/1/push';
     $data = array('where' => ['email' => ['$in' => $users_array]], 'data' => array('alert' => $task->name, 'title' => $MESSAGE));
     $_data = json_encode($data);
     $headers = array('X-Parse-Application-Id: ' . $this->APPLICATION_ID, 'X-Parse-REST-API-Key: ' . $this->REST_API_KEY, 'Content-Type: application/json', 'Content-Length: ' . strlen($_data));
     $curl = curl_init($url);
     curl_setopt($curl, CURLOPT_POST, 1);
     curl_setopt($curl, CURLOPT_POSTFIELDS, $_data);
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
     curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
     curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     $response = curl_exec($curl);
     $this->_arData['data']['idTask'] = $task->id;
     return $this;
 }
Beispiel #8
0
 /**
  * Responds to requests to POST /tasks/create
  */
 public function postCreate(Request $request)
 {
     $this->validate($request, ['title' => 'required|min:5', 'detail' => 'required|min:5', 'status' => 'required|min:5']);
     # Enter task into the database
     $task = new \App\Task();
     $task->title = $request->title;
     $task->detail = $request->detail;
     $task->owner_id = $request->owner;
     $task->user_id = \Auth::id();
     $task->status = $request->status;
     $task->save();
     # Done
     \Session::flash('flash_message', 'Success! Your task was added.');
     \Session::flash('flash_type', 'alert-success');
     return redirect('/tasks');
     #return 'Process adding new task: '.$request->input('title');
 }