/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $data = $request->toArray();
     $data['amount'] = preg_replace("/[^0-9\\.]/", "", $data['amount']);
     Expense::create($data);
     return redirect('/expense');
 }
 /**
  * Show Insurance page.
  *
  * @param Request $request
  *
  * @return Redirect
  */
 public function selectCar(Request $request)
 {
     /*
      * Put all the request info including order info
      * to session, for next pages use.
      */
     Session::put('orderInfo', $request->toArray());
     return redirect('/reservation/insurance');
 }
 /**
  * Login In User
  *
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function authenticate(Request $request)
 {
     $validator = $this->getValidationFactory()->make($request->toArray(), ['credential' => 'required', 'password' => 'required|min:6']);
     if ($validator->fails()) {
         return response()->json(['error' => $validator->errors()]);
     }
     $field = filter_var($request->input('credential'), FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
     $request->merge([$field => $request->input('credential')]);
     if (!$this->auth->attempt($request->only($field, 'password'))) {
         return response()->json(['error' => 'invalid_username_or_password']);
     }
     dispatch(new GenerateTokenJob($this->auth->user(), true));
     /** @var User $user */
     $user = $this->auth->user()->load('codes', 'codes.product', 'codes.product.extras', 'codes.product.profile');
     /**
      * inject product combination if not admin
      */
     $this->injectProductCombo($user);
     /**
      * Give all Products to admins
      */
     $this->adminFunction($user);
     return response()->json($user);
 }
Example #4
0
 /**
  * Get all of the input and files for the request.
  *
  * @return array 
  * @static 
  */
 public static function toArray()
 {
     return \Illuminate\Http\Request::toArray();
 }
Example #5
0
 public function sort(Request $request)
 {
     $this->getQuery()->where($request->toArray());
     return $this->response();
 }
 public function index(Request $request)
 {
     // Handles requests such as ".../api/agendas?description='hej'"
     return response(Agenda::where($request->toArray())->get());
 }
 /**
  * ManyToMany generate.
  *
  * @param \Illuminate\Http\Request
  *
  * @return \Illuminate\Http\Response
  */
 public function manyToMany(Request $request)
 {
     if ($this->check($request->toArray())) {
         Session::flash('status', 'Error! can not be related');
         return redirect('scaffold');
     }
     $manytomany = new \Amranidev\ScaffoldInterface\ManyToMany\ManyToMany($request->except('_token'));
     $manytomany->burn();
     Session::flash('status', 'ManyToMany generated successfully');
     return redirect('/scaffold');
 }
Example #8
0
 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     \Log::info('request', $request->toArray());
     return $next($request);
 }
 public function index(Request $request)
 {
     // Handles requests such as ".../api/activities?agenda_id=1&type=someType"
     return response(Activity::where($request->toArray())->get());
 }