I have tabel: tags(id,name,created_at, updated_ad)
I have model:
tag
class Tag extends Model
{
protected $fillable = [
'name',
];
protected $dates = [
'created_at',
'updated_at',
];
public function Posts()
{
return $this->morphedByMany(Post::class, 'taggable');
}
}
I have tag controller:
class TagController extends Controller
{
public function show(Tag $Tag)
{
return Response::json($Tag);
}
}
I have routs:
Route::group(['namespace' => 'Tags', 'prefix' => 'tags'], function () {
Route::get('/{tags}', 'TagController@show');
Route::delete('/{tags}', 'TagController@destroy')->middleware('auth:api');
});
I try to get tag with id, but it don't work. What i do wrong or what of forget define?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2wraddi
via IFTTT
Aucun commentaire:
Enregistrer un commentaire