Beispiel #1
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $rules = [];
     if ('Rukan\\Map\\Http\\Controllers\\MapController@searchMarkers' != Request::route()->getActionName()) {
         $rules = ['name' => 'required', 'description' => 'required', 'contact' => 'required', 'type' => 'required', 'lat' => 'required', 'lng' => 'required'];
     }
     return $rules;
 }
Beispiel #2
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $act = Request::route('act');
     if ($act == 'add') {
         return ['name' => 'required|alpha_dash|max:32|unique:user,name', 'password' => 'required|min:6|max:32', 'email' => 'email'];
     } else {
         return ['name' => 'required|alpha_dash|unique:user,name', 'password' => 'min:6|max:32', 'email' => 'email'];
     }
 }
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $routeParam = isset(Request::route()->user) ? Request::route()->user : null;
     $id = $this->user;
     if ($routeParam == $id) {
         return true;
     }
     return redirect()->back();
 }
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if (Request::route()->getMethods()[0] == 'PATCH') {
         $meeting = Request::route()->getParameter('meeting');
         if ($meeting->user->id !== Auth::id()) {
             return false;
         }
     }
     return true;
 }
Beispiel #5
0
 /**
  * Get the validation rules that apply to the request.
  * Dynamically apply rules based on what type of request is being made
  * 
  * @return array
  */
 public function rules()
 {
     switch (Request::route()->getUri()) {
         case "login":
             $rules = ['name' => 'required|min:3|exists:users,name', 'password' => 'required|min:8|hashed'];
             break;
         case "register":
             $rules = ['name' => 'required|min:3|unique:users', 'email' => 'required|email|unique:users', 'password' => 'required|min:8|confirmed'];
             break;
         case "forgot/{token}":
             $rules = ['password' => 'required|min:8|confirmed'];
             break;
             // for users/{user}/edit and users/profile
         // for users/{user}/edit and users/profile
         default:
             $rules = [];
             break;
     }
     return $rules;
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $id = Request::route()->parameter('id');
     $unique = $id ? 'unique:clients,email,' . $id : 'unique:clients';
     return ['email' => 'required|email|' . $unique . '|max:255', 'name' => 'required|max:255', 'company' => 'required|max:255', 'phone' => 'required|max:255', 'cellphone' => 'required|max:255'];
 }