Пример #1
0
 public function store(Request $request)
 {
     $quote = new Quote(array('quote' => $request->get('quote'), 'author' => $request->get('author')));
     $quote->save();
     Toastr::success('Quote created.');
     return redirect('/quotes');
 }
Пример #2
0
 private function createQuote($params)
 {
     try {
         $quote = new Quote();
         $quote->setParams($params);
         $quote->save();
         return $quote;
     } catch (\Exception $e) {
         getSystem()->getRender()->error(500, "Error while creating quote", $e);
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store($client_id, Request $request)
 {
     $quote = new Quote();
     $client = Client::findOrFail($client_id);
     $quote_count = $client->quotes()->count();
     $quote->client_specific_id = $quote_count + 1;
     $quote->client_id = $client_id;
     $quote->user_id = Auth::user()->id;
     $quote->issue_date = $request->issue_date;
     $quote->amount = $request->amount;
     $quote->is_accepted = 0;
     $quote->save();
     return redirect('clients/' . $client_id);
 }
Пример #4
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['body' => 'required|string', 'description' => 'required|string', 'tags' => 'required|array']);
     $tags = array_map(function ($tag) {
         return new Tag(['body' => $tag]);
     }, $request->input('tags'));
     $quote = new Quote();
     $quote->approved = false;
     $quote->body = $request->input('body');
     $quote->description = $request->input('description');
     // FIXME: Replace with currently auth'd member
     $quote->member_id = $request->member->id;
     $quote->save();
     $quote->tags()->saveMany($tags);
     return new JsonResponse($quote, Response::HTTP_CREATED);
 }
 public function addQuote()
 {
     $user = User::find(Auth::user()->id);
     if (isset($user)) {
         $quote = new Quote();
         $quote->user_id = $user->id;
         if (Input::get('add_text') != '') {
             $quote->text = Input::get('add_text');
         }
         if (Input::get('add_author') != '') {
             $quote->author = Input::get('add_author');
         }
         if (Input::get('add_extra_1') != '') {
             $quote->extra_1 = Input::get('add_extra_1');
         }
         if (Input::get('add_extra_2') != '') {
             $quote->extra_2 = Input::get('add_extra_2');
         }
         $quote->save();
         return redirect('home')->with('status', 'success');
     } else {
         return 'An error has occured';
     }
 }