mercredi 25 juillet 2018

Laravel 5.6. Route model bindung

Hello I'm trying to create own laravel package it has two Controller resource, which have single controller and model Post

    Route::resource('posts', \vendor\package\Controllers\PostsController::class);
    Route::resource('categories', \vendor\package\Controllers\PostsController::class);

My method in the PostsController is show(Post $post)

If I open link http://localhost/posts/1, attributes element of $post is not empty in the show method.

But when I open link http://localhost/categories/1, attributes element of $post is empty.

How can I get Post data for resource categories?

P.S. difference between posts and categories is value of column post_type in the DB.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire