app/Http/Controllers/AdminUserController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Userquest $request)
    {
          if(trim($request->password == '')){
            $input = $request->except('password');
        }  else {
            $input = $request->all();
            $input['password'] = bcrypt($request->password);
        }
        if($file = $request->file('photo_id')){
            $name = time() . $file->getClientOriginalName();
            $file->move('images',$name);
            create to table Photo
            $photo = Photo::create(['file'=>$name]);
            $input['photo_id'] = $photo->id;
        }
        User::create($input);
        Session::flash('create_user','The user has been successful!!!');
        return back();
    }
public function store ( Userquest $ request ) { if ( trim ( $ request -> password == '' ) ) { $ input = $ request -> except ( 'password' ) ; } else { $ input = $ request -> all ( ) ; $ input [ 'password' ] = bcrypt ( $ request -> password ) ; } if ( $ file = $ request -> file ( 'photo_id' ) ) { $ name = time ( ) . $ file -> getClientOriginalName ( ) ; $ file -> move ( 'images' , $ name ) ; $ photo = Photo :: create ( [ 'file' => $ name ] ) ; $ input [ 'photo_id' ] = $ photo -> id ; } User :: create ( $ input ) ; Session :: flash ( 'create_user' , 'The user has been successful!!!' ) ; return back ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// $input = $request->all(); //  // create to table Photo //get photo_id to user