app/Providers/RouteServiceProvider.php
Route::bind('citizenships', function ($value, $route) { // not work in plural
return $this->getModel(\App\Models\Citizenship::class, $value);
});
Routes in plural:
The model:
namespace App\Models;
use App\Traits\Hashidable;
use App\Models\Scopes\Searchable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Citizenship extends Model
{
use Hashidable;
use HasFactory;
use Searchable;
protected $fillable = [];
protected $searchableFields = ['*'];
Currently I have a table for users and it works very well (singular route bind), I also use a table for sessions and there are no problems with the User model. The configurations for Citizenship it is the same as the User model. Now, That's the right behavior, handling routes in sigular, in the RouteServiceprovider??
Hi.
I got this error in a table
The configuration:
Routes in plural:
Currently I have a table for users and it works very well (singular route bind), I also use a table for sessions and there are no problems with the User model. The configurations for Citizenship it is the same as the User model. Now, That's the right behavior, handling routes in sigular, in the RouteServiceprovider??
The user working fine.
The Citizenship error: