I need to create triadic relation in laravel framework.
Consider three models: Card, Notes, User.
Card is related to notes and user, while they are related to each other. Now in models, when the relation ship would be drafted, Card->belongTo -> Notes Notes-> hasMany -> Card
The problem is when relationship between card and user is created, keeping to above rules,the connection is not made.
user -> hasMany ->card; Card ->belongTo -> user.
stacktrace:
1/1 MethodNotAllowedHttpException in RouteCollection.php line 218:
in RouteCollection.php line 218
at RouteCollection->methodNotAllowed(array('POST')) in RouteCollection.php line 205
at RouteCollection->getRouteForMethods(object(Request), array('POST')) in RouteCollection.php line 158
at RouteCollection->match(object(Request)) in Router.php line 821
at Router->findRoute(object(Request)) in Router.php line 691
at Router->dispatchToRoute(object(Request)) in Router.php line 675
at Router->dispatch(object(Request)) in Kernel.php line 246
at Kernel->IlluminateFoundationHttp{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at Pipeline->IlluminateRouting{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136
at Pipeline->IlluminatePipeline{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at Pipeline->IlluminateRouting{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Kernel.php line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99
at Kernel->handle(object(Request)) in index.php line 53
at require_once('/home/sayali/people_finder/public/index.php') in server.php line 21
my user.php - has a func Cards
public function cards()
{
return $this->hasMany(Note::class);
}
in cards.php
public function user()
{
return $this->belongsTo(User::class);
}
Aucun commentaire:
Enregistrer un commentaire