public function thing_created()
 {
     $thing_name = $_POST['thing_name'];
     $thing = new Thing();
     $thing->name = $thing_name;
     $thing->project_id = 11;
     $thing->save();
     return view('Pages.Things.things_created');
 }
Beispiel #2
0
 /**
  * Include comments.
  *
  * @param  \App\Thing $thing
  * @param  \League\Fractal\ParamBag|null $params
  * @return  \League\Fractal\Resource\Collection
  * @throws  \Exception
  */
 public function includeComments(Thing $thing, $params)
 {
     if ($params) {
         $this->validateParams($params);
     }
     list($limit, $offset) = $params->get('limit') ?: config('api.include.defaultLimit');
     list($orderCol, $orderBy) = $params->get('order') ?: config('api.include.defaultOrder');
     $comments = $thing->comments()->take($limit)->offset($offset)->orderBy($orderCol, $orderBy)->get();
     return $this->collection($comments, new \App\Transformers\CommentTransformer());
 }
 /**
  * save the things form
  * @return string(success)
  */
 public function saveThingsForm(Request $request)
 {
     DB::connection()->enableQueryLog();
     $things = new Thing();
     $donate = new Donate();
     $donate->donorId = Auth::user()->user_id;
     $donate->moneyId = 0;
     $donate->thingId = $request->input('id');
     $donate->problemId = $request->input('id');
     $donate->save();
     $things->name = $request->input('name');
     $things->location = $request->input('address');
     $things->description = $request->input('description');
     $things->quantity = $request->input('quantity');
     $things->problemId = $request->input('id');
     $things->save();
     $query = DB::getQueryLog();
     //return print_r($query);
     return "done";
 }
 public function project_details($project_name)
 {
     $things = Thing::where('project_id', $project_name)->get();
     return view('Pages.Projects.project_details', compact('things'));
 }
 public function deleteThing($id)
 {
     $thing = Thing::findOrFail($id);
     $thing->delete();
     flash()->error('Przedmiot o ID <b>' . $id . '</b> został usunięty z bazy danych!');
     return redirect('/admin/thing');
 }
 /**
  * save the things form
  * @return string(success)
  */
 public function saveThingsForm(Request $request)
 {
     $things = new Thing();
     $donate = new Donate();
     $donate->donorId = Auth::user()->id;
     $donate->moneyId = 0;
     $donate->thingId = $request->input('id');
     $donate->save();
     $things->name = $request->input('name');
     $things->location = $request->input('address');
     $things->description = $request->input('description');
     $things->quantity = $request->input('quantity');
     $things->problemId = $request->input('id');
     $things->save();
     return "done";
 }