app/Http/Controllers/ClientManagement/ClientController.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)
    {
         $this->validate($request,[
            "name" => "string|required",
            "address" => "string|required",
            'email' => 'email|required||unique:clients',
            "phone_no" => 'required|max:12|string'
        ]);
        $client = new Client;
        $client->name = $request->name;
        $client->address = $request->address;
        $client->email = $request->email;
        $client->phone_no = $request->phone_no;
        $client->slug = Str::slug($request->name,'-');
        $client->user_id = Auth::id();
        $client->save();
        Toastr::success('Client added Successfully', 'Success', ["positionClass" => "toast-bottom-right"]);
        return redirect()->route('clients.index');
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ " name " => " string|required " , " address " => " string|required " , 'email' => 'email|required||unique:clients' , " phone_no " => 'required|max:12|string' ] ) ; $ client = new Client ; $ client -> name = $ request -> name ; $ client -> address = $ request -> address ; $ client -> email = $ request -> email ; $ client -> phone_no = $ request -> phone_no ; $ client -> slug = Str :: slug ( $ request -> name , '-' ) ; $ client -> user_id = Auth :: id ( ) ; $ client -> save ( ) ; Toastr :: success ( 'Client added Successfully' , 'Success' , [ " positionClass " => " toast-bottom-right " ] ) ; return redirect ( ) -> route ( 'clients.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .