app/Http/Controllers/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)
    {
        $client = new Client();
        $clientName = $request->clientName;
        $clientCode = $request->clientCode;
        $status     = $request->statusCode;
        $result = $client->addClient($clientName, $clientCode, $status);
        if($result) {
             \Session::flash('flash_message','New client created successfully.');
        } else {
             \Session::flash('error_message','Error in handling request.');
        }
        return redirect('clients');
    }
public function store ( Request $ request ) { $ client = new Client ( ) ; $ clientName = $ request -> clientName ; $ clientCode = $ request -> clientCode ; $ status = $ request -> statusCode ; $ result = $ client -> addClient ( $ clientName , $ clientCode , $ status ) ; if ( $ result ) { \ Session :: flash ( 'flash_message' , 'New client created successfully.' ) ; } else { \ Session :: flash ( 'error_message' , 'Error in handling request.' ) ; } return redirect ( 'clients' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// instantiate model class // get params from post request // call function from model to add client to database // redirect to index after save