示例#1
0
 public function index(BaseRequest $request)
 {
     $query_params = ['filters' => [], 'search' => [], 'per_page' => (int) array_get($request->all(), 'per_page', 10), 'page' => (int) array_get($request->all(), 'page', 1)];
     $searchQuery = array_get($request, 'searchQuery');
     /*
      * Default Values
      */
     if (count($this->default_values) > 0) {
         foreach ($this->default_values as $k => $v) {
             $query_params['filters'][$k] = $v;
         }
     }
     /*
      * Filters
      */
     if (count($this->filter_values) > 0) {
         foreach ($this->filter_values as $v) {
             $query_params['filters'][$v] = array_get($request, $v);
         }
     }
     /*
      * Search
      */
     if (count($this->search_fields) > 0) {
         foreach ($this->search_fields as $v) {
             $query_params['search'][$v] = $searchQuery;
         }
     }
     list($headers, $data) = $this->repo->getAll(['*'], $query_params);
     $list = $this->response->paginatedCollection($data, $this->transformer);
     return response()->json($list['data'], 200, $headers);
 }
 public function send(BaseRequest $request)
 {
     Mail::send('emails.contact', ['data' => $request->all()], function ($m) {
         $m->from('*****@*****.**', 'Joel Podrebarac | Web Developer');
         $m->to('*****@*****.**', 'Joel Podrebarac')->subject('A Message From Your Site');
     });
 }
示例#3
0
 public function logout(BaseRequest $request)
 {
     if ($this->repo->logout($request->header('authorization'))) {
         return response()->json(['message' => 'Logged Out'], $status = 201, []);
     } else {
         return false;
     }
 }
示例#4
0
 public function upload(BaseRequest $request)
 {
     //        $this->validate($request, [
     //            "file" => 'image',
     //            "file_url" => 'active_url',
     //            'scope' => 'string',
     //            'scope_id' => 'integer'
     //        ]);
     return response()->json($this->response->item($this->repo->upload($request->all(), $file = $request->file('file')), $this->transformer));
 }