jeudi 30 juin 2016

Get currently created model id in Laravel 5

Laravel 5.2

I have some problem with getting model id:

    public function store(Request $request)
{

    $this->validate($request, [
        'title'   => 'required|max:255',
        'content' => 'required',
    ]);

    $data = $request->all();

    $page = new Page;

    $page->create($data);

    dd($page->id);

    return redirect()->route('admin.pages.index');
}

$page->id return null...

what am I doing wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire