app/Http/Controllers/Admin/AdminCustomerController.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(Request $request)
    {
        $data = $request->validate([
            'name' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'username' => ['required', 'string','max:255', 'unique:users'],
            'password' => ['required', 'string', 'min:8'],
        ]); 
        User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'username' => $data['username'],
            'role' => 1,
            'password' => Hash::make($data['password']),
        ]);
        return redirect('/admin/customers')->with('success','Customer added successfully!');;
    }
public function store ( Request $ request ) { $ data = $ request -> validate ( [ 'name' => [ 'required' , 'string' , 'max:255' ] , 'email' => [ 'required' , 'string' , 'email' , 'max:255' , 'unique:users' ] , 'username' => [ 'required' , 'string' , 'max:255' , 'unique:users' ] , 'password' => [ 'required' , 'string' , 'min:8' ] , ] ) ; User :: create ( [ 'name' => $ data [ 'name' ] , 'email' => $ data [ 'email' ] , 'username' => $ data [ 'username' ] , 'role' => 1 , 'password' => Hash :: make ( $ data [ 'password' ] ) , ] ) ; return redirect ( '/admin/customers' ) -> with ( 'success' , 'Customer added successfully!' ) ; ; }
Store a newly created resource in storage.
Store a newly created resource in storage .