-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
Hello everybody,
I am trying to implement this package. Unfortunately I am getting this error:
No query results for model [App\PositionProductCategory]
once I am running
new PositionProduct($position['product']);
```
This is the trace:
```
array:43 [
0 => array:5 [
"file" => "/home/vagrant/code/vendor/troelskn/laravel-fillable-relations/src/Eloquent/Concerns/HasFillableRelations.php"
"line" => 113
"function" => "firstOrFail"
"class" => "Illuminate\Database\Eloquent\Builder"
"type" => "->"
]
1 => array:5 [
"file" => "/home/vagrant/code/vendor/troelskn/laravel-fillable-relations/src/Eloquent/Concerns/HasFillableRelations.php"
"line" => 78
"function" => "fillBelongsToRelation"
"class" => "App\PositionProduct"
"type" => "->"
]
2 => array:5 [
"file" => "/home/vagrant/code/vendor/troelskn/laravel-fillable-relations/src/Eloquent/Concerns/HasFillableRelations.php"
"line" => 88
"function" => "fillRelations"
"class" => "App\PositionProduct"
"type" => "->"
]
3 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php"
"line" => 173
"function" => "fill"
"class" => "App\PositionProduct"
"type" => "->"
]
4 => array:5 [
"file" => "/home/vagrant/code/app/Http/Controllers/OfferApiController.php"
"line" => 311
"function" => "__construct"
"class" => "Illuminate\Database\Eloquent\Model"
"type" => "->"
]
5 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Support/Traits/EnumeratesValues.php"
"line" => 202
"function" => "App\Http\Controllers\{closure}"
"class" => "App\Http\Controllers\OfferApiController"
"type" => "->"
]
6 => array:5 [
"file" => "/home/vagrant/code/app/Http/Controllers/OfferApiController.php"
"line" => 359
"function" => "each"
"class" => "Illuminate\Support\Collection"
"type" => "->"
]
7 => array:3 [
"function" => "update"
"class" => "App\Http\Controllers\OfferApiController"
"type" => "->"
]
8 => array:3 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Controller.php"
"line" => 54
"function" => "call_user_func_array"
]
9 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php"
"line" => 45
"function" => "callAction"
"class" => "Illuminate\Routing\Controller"
"type" => "->"
]
10 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Route.php"
"line" => 239
"function" => "dispatch"
"class" => "Illuminate\Routing\ControllerDispatcher"
"type" => "->"
]
11 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Route.php"
"line" => 196
"function" => "runController"
"class" => "Illuminate\Routing\Route"
"type" => "->"
]
12 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Router.php"
"line" => 685
"function" => "run"
"class" => "Illuminate\Routing\Route"
"type" => "->"
]
13 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 128
"function" => "Illuminate\Routing\{closure}"
"class" => "Illuminate\Routing\Router"
"type" => "->"
]
14 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php"
"line" => 41
"function" => "Illuminate\Pipeline\{closure}"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
15 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 167
"function" => "handle"
"class" => "Illuminate\Routing\Middleware\SubstituteBindings"
"type" => "->"
]
16 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php"
"line" => 44
"function" => "Illuminate\Pipeline\{closure}"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
17 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 167
"function" => "handle"
"class" => "Illuminate\Auth\Middleware\Authenticate"
"type" => "->"
]
18 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php"
"line" => 59
"function" => "Illuminate\Pipeline\{closure}"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
19 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 167
"function" => "handle"
"class" => "Illuminate\Routing\Middleware\ThrottleRequests"
"type" => "->"
]
20 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 103
"function" => "Illuminate\Pipeline\{closure}"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
21 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Router.php"
"line" => 687
"function" => "then"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
22 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Router.php"
"line" => 662
"function" => "runRouteWithinStack"
"class" => "Illuminate\Routing\Router"
"type" => "->"
]
23 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Router.php"
"line" => 628
"function" => "runRoute"
"class" => "Illuminate\Routing\Router"
"type" => "->"
]
24 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Routing/Router.php"
"line" => 617
"function" => "dispatchToRoute"
"class" => "Illuminate\Routing\Router"
"type" => "->"
]
25 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php"
"line" => 165
"function" => "dispatch"
"class" => "Illuminate\Routing\Router"
"type" => "->"
]
26 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 128
"function" => "Illuminate\Foundation\Http\{closure}"
"class" => "Illuminate\Foundation\Http\Kernel"
"type" => "->"
]
27 => array:5 [
"file" => "/home/vagrant/code/vendor/fideloper/proxy/src/TrustProxies.php"
"line" => 57
"function" => "Illuminate\Pipeline\{closure}"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
28 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 167
"function" => "handle"
"class" => "Fideloper\Proxy\TrustProxies"
"type" => "->"
]
29 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php"
"line" => 21
"function" => "Illuminate\Pipeline\{closure}"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
30 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 167
"function" => "handle"
"class" => "Illuminate\Foundation\Http\Middleware\TransformsRequest"
"type" => "->"
]
31 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php"
"line" => 21
"function" => "Illuminate\Pipeline\{closure}"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
32 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 167
"function" => "handle"
"class" => "Illuminate\Foundation\Http\Middleware\TransformsRequest"
"type" => "->"
]
33 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php"
"line" => 27
"function" => "Illuminate\Pipeline\{closure}"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
34 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 167
"function" => "handle"
"class" => "Illuminate\Foundation\Http\Middleware\ValidatePostSize"
"type" => "->"
]
35 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php"
"line" => 63
"function" => "Illuminate\Pipeline\{closure}"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
36 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 167
"function" => "handle"
"class" => "Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode"
"type" => "->"
]
37 => array:5 [
"file" => "/home/vagrant/code/app/Http/Middleware/SetLocale.php"
"line" => 20
"function" => "Illuminate\Pipeline\{closure}"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
38 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 167
"function" => "handle"
"class" => "App\Http\Middleware\SetLocale"
"type" => "->"
]
39 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php"
"line" => 103
"function" => "Illuminate\Pipeline\{closure}"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
40 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php"
"line" => 140
"function" => "then"
"class" => "Illuminate\Pipeline\Pipeline"
"type" => "->"
]
41 => array:5 [
"file" => "/home/vagrant/code/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php"
"line" => 109
"function" => "sendRequestThroughRouter"
"class" => "Illuminate\Foundation\Http\Kernel"
"type" => "->"
]
42 => array:5 [
"file" => "/home/vagrant/code/public/index.php"
"line" => 55
"function" => "handle"
"class" => "Illuminate\Foundation\Http\Kernel"
"type" => "->"
]
]
```
This is the relation in the model:
```
public function category()
{
return $this->belongsTo(PositionProductCategory::class);
}
```
And of course `PositionProductCategory` does exist.
Maybe the problem is, that my model do not extend `Model` but `Product` and `ProductCategory`?
```
class PositionProduct extends Product
{
use ProductTrait, HasFillableRelations;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable
= [
...
];
protected $fillable_relations = ['category'];
Metadata
Metadata
Assignees
Labels
No labels