lundi 26 février 2018

How to insert data into mysql database using laravel

I'm new to Laravel and I want to insert data into the database. This is my code and Can anyone help me to do this insertion.

class Test1Controller extends Controller {
public function index(Request $req)
{
    $item = $req->input('item');
    $name = $req->input('name');
    $data=array('item'=>$item,'name'=>$name);
    DB::table('test1')->insert($data)

    $view = view('common.test1');
    $obj = DB::table('test1')->get();
    $view->obj = $obj;
    return $view;
}   

and this is my route file code

Route::post('/test/test1/index/','Controller@index');

I got an error Call to undefined method Illuminate\Support\Facades\Request::input()



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2HQwBne
via IFTTT

Aucun commentaire:

Enregistrer un commentaire