app/Http/Controllers/adminController.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(adminURequest $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);
        return redirect('/admin/u');
    }
public function store ( adminURequest $ 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 ) ; return redirect ( '/admin/u' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//