jeudi 25 janvier 2018

Laravel 5 ,Table not updating

enter image description hereIm Trying to update my table through Laravel Updation,i get no error when i tried to print the result i just got an null value ,i have pasted my model and controller.

controller

     public function update_FAQ_submit()
                        {

         $data      = Input::except(array(
            '_token'
        ));
        $rule      = array(
            'faq_ques' => 'required',
            'faq_ans' => 'required'

        );
        $id        = Input::get('id');
        $validator = Validator::make($data, $rule);
        if ($validator->fails()) {
            return Redirect::to('Coin_lion/FAQ')->withErrors($validator->messages())->withInput();

        } else {
            $entry = array(
                'faq_ques' => Input::get('faq_ques'),
                'faq_ans' => Input::get('faq_ans')

            );

            $faq=FAQ::update_faq($id, $entry);

            return Redirect::to('Coin_lion/manage_FAQ');
        }
                    }  

Model

public static function update_faq($id, $entry)
{

    return DB::table('faq')->where('id', '=', $id)->update($entry);



}

Routes:

Route::post('Coin_lion/update_FAQ_submit','AdminController@update_FAQ_submit');



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire