You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But if you'd like more control over the container instance, or would like to pass model name dynamically you can alternatively to as follow:
278
+
```php
279
+
namespace App\Repositories;
280
+
252
281
use Illuminate\Contracts\Container\Container;
253
282
use Rinvex\Repository\Repositories\EloquentRepository;
254
283
@@ -265,7 +294,7 @@ class FooRepository extends EloquentRepository
265
294
}
266
295
```
267
296
268
-
Now inside your controller, you can either instantiate the repository traditionaly through `$repository = new \App\Repositories\FooRepository();` or to use Laravel's awesome dependency injection and let the IoC do the magic:
297
+
Now inside your controller, you can either instantiate the repository traditionally through `$repository = new \App\Repositories\FooRepository();` or to use Laravel's awesome dependency injection and let the IoC do the magic:
269
298
```php
270
299
namespace App\Http\Controllers;
271
300
@@ -312,10 +341,10 @@ ___
312
341
The `setContainer` method sets the IoC container instance, while `getContainer` returns it:
@@ -592,7 +623,7 @@ Repositories fire events at every action, like `create`, `update`, `delete`. All
592
623
593
624
For your convenience, the events suffixed with `.entity.created`, `.entity.updated`, or `.entity.deleted` have listeners that take actions accordingly. Usually we need to flush cache -if enabled & exists- upon every success action.
594
625
595
-
There's one more event `rinvex.repository.uniqueid.entity.cache.flushed` that's fired on cache flush. It has no listeners by default, but you may need to listen to it if you've model relashions for further actions.
626
+
There's one more event `rinvex.repository.uniqueid.entity.cache.flushed` that's fired on cache flush. It has no listeners by default, but you may need to listen to it if you've model relations for further actions.
596
627
597
628
### Mandatory Repository Conventions
598
629
@@ -644,7 +675,7 @@ Here some conventions important to know while using this package. This package a
644
675
645
676
### Automatic Guessing
646
677
647
-
While it's **recomended** to explicitly set IoC container, repository identifier, and repository model; This package is smart enough to guess any of these required data whenever missing.
678
+
While it's **recommended** to explicitly set IoC container, repository identifier, and repository model; This package is smart enough to guess any of these required data whenever missing.
648
679
649
680
-**IoC Container**`app()` helper is used as a fallback if IoC container instance not provided explicitly.
650
681
-**Repository Identifier** It's recommended to set repository identifier as a doted name like `rinvex.repository.uniqueid`, but if it's missing fully qualified repository class name will be used (actually the result of `get_called_class()` function).
0 commit comments