Skip to main content
Filter by
Sorted by
Tagged with
3 votes
1 answer
84 views

I have an invokable action class called: AttachMembersToRoom . Now, aside from basic form request validations, I also have complex validation, like comparing values across members, identify ...
ssrsvn's user avatar
  • 33
0 votes
0 answers
250 views

I'm using Laravel 7. would like like to inject services into a event listener. Injecting their interfaces through the constructor works fine, but when I add "implements ShouldQueue" to the ...
Richard House's user avatar
0 votes
1 answer
123 views

GET|HEAD blogs ..................................................................................... blog.index › Blog\BlogController@index POST blogs ...............................
Bikash Chowdhury's user avatar
0 votes
1 answer
186 views

I just recently started learning Laravel and decided to dive in learning by doing. As far as i understand from documentation [example:1] [example:2] i can typehint properties in constructors for ...
Vatai Domonkos's user avatar
5 votes
2 answers
14k views

I want to add service provider in laravel 11, but i am not sure how to add it using laravel 11. As previous version of laravel, it is added in config/app.php file, but in laravel 11 it needs to be ...
Isha's user avatar
  • 179
0 votes
0 answers
69 views

My question is: How can I use laravel service containers to do heavy tasks. Actually I would like to use service containers to increase the performance. Suppose we have the below class: class ...
farhad.a's user avatar
  • 351
1 vote
0 answers
316 views

Context: From a Laravel service container, we can easily bind abstracts to concrete implementations, and variables to scalar types, using the following, respectively: // Abstracts to concrete ...
exastris's user avatar
0 votes
1 answer
772 views

For example I have a class named User and in its constructor I have a dependency named MyDependency. MyDependency does not have any dependencies itself so I don't need to bind it to he $app container. ...
Abw's user avatar
  • 35
1 vote
0 answers
164 views

I just made changes to the application structure for my Laravel application. It works well when runnning tests (for the Http controllers). The problem is when i try to run artisan commands (that ...
Azvya Erstevan's user avatar
0 votes
2 answers
1k views

I want to mock a service who call a third party, but I can't figure it out. I have a controller method who has a service injected on it and do stuff: public function store(Request $request, MyService $...
Nathan Meyer's user avatar
0 votes
0 answers
134 views

Would like to build in a simple validation for the value of the APP_ENV parameter in my Laravel application. I want the parameter to be either dev, tst, acc or prd. If it's not one of these, my ...
Lucas Johnston's user avatar
1 vote
1 answer
453 views

In laravel 9 app I try to switch to different service class AppServiceProvider extends ServiceProvider { /** * Register any application services. * * @return void */ public ...
mstdmstd's user avatar
  • 3,309
0 votes
1 answer
81 views

I have an interface that I wish to resolve on controllers. On registration inside a service provider, I am binding a class to the Service on condition. Here is my service interface and two classes. ...
John's user avatar
  • 393
1 vote
2 answers
226 views

In laravel 9 app I created class app/Implementations/LocalStorageUploadedFileManagement.php : <?php namespace App\Implementations; use App\Interfaces\UploadedFileManagement; ... use Intervention\...
mstdmstd's user avatar
  • 3,309
0 votes
0 answers
425 views

Followed every step from laravel 9 manual, and my service will not register consistently. Don't quite know why but it suddenly breaks and I receive a Target class [thumbnail] does not existerror out ...
thomi's user avatar
  • 1,697
0 votes
2 answers
1k views

I have just started exploring laravel but I have one confusion . I know how to create own custom function file and make it available globally using compose.json file but I was trying to figure out how ...
Ashu's user avatar
  • 11
2 votes
1 answer
1k views

I'm trying to set filesystem configuration value dynamically in controller level. (I think it's almost impossible). For example: 'sftp' => [ 'driver' => 'sftp', 'host' => ...
LoveCoding's user avatar
  • 1,201
0 votes
1 answer
222 views

Difference between service & trait in Laravel Assume I have a class which handles image uploading on my application Should I write it as service or trait ? when i should use service and trait ?
Red Coder's user avatar
4 votes
3 answers
2k views

What I want to achieve is I have a service class name 'SmsService' <?php namespace App\Services; use App\Contracts\SmsServiceContract; use App\Models\Student; use Twilio\Rest\Client; class ...
Shahrukh's user avatar
  • 498
0 votes
0 answers
556 views

Due to debugging reasons (I am hunting down a very weird bug), I need to extend the Laravel classes Illuminate\Database\DatabaseManager, Illuminate\Database\Connection, and Illuminate\Database\Query\...
user2690527's user avatar
  • 1,931
0 votes
2 answers
145 views

I am using Laravel 8. I want to know the difference between new User() and User::class because I am having trouble while using new User(). Here is the scenario, I have UserServices class in which I am ...
Ahmar Arshad's user avatar
2 votes
1 answer
57 views

I have an API class that is being bound into the container via a service provider: public function register() { $this->app->bind('apiclient', fn($app) => new APIClient($app)); } It is ...
ConBran's user avatar
  • 379
3 votes
0 answers
263 views

I got a question. Is it best practice to define gates in custom service providers? I am writing a permission system in Laravel by defining gates for each permission. I created a custom service ...
Dennis's user avatar
  • 31
0 votes
1 answer
205 views

I want to provide some default settings to a controller when it is instantiated. My end goal is to provide a dummy object for testing which I can use with registerPaymentMethod on my controller To ...
Zakalwe's user avatar
  • 1,662
1 vote
0 answers
358 views

I want to switch the payment gateway based on the user's request. I don't want multiple endpoints for each gateway, so i'm trying write one endpoint that handles multiple payment gateways. With that, ...
Chris's user avatar
  • 5,093
1 vote
0 answers
56 views

In the laravel Request facade we have the key 'request' being returned. To my understanding this is the key that is bound to the service container to resolve a class. In which file do we have the ...
Alphy Gacheru's user avatar
0 votes
2 answers
2k views

I have the following routes in routes/api.php: Route::get('items/{item}', function(Guid $item) {...}); Route::get('users/{user}', function(Guid $user) {...}); Since Guid is a custom type, how can I ...
shaedrich's user avatar
  • 5,763
6 votes
2 answers
4k views

In the service container of Laravel, I can bind both singleton and instance. From the Laravel doc: Binding A Singleton The singleton method binds a class or interface into the container that should ...
Istiaque Ahmed's user avatar
0 votes
1 answer
324 views

I'm attempting to store an instance of the current department in Laravels Service Container, however sometimes this department may be null. The department itself is loaded from session and retrieved ...
Sheph's user avatar
  • 675
4 votes
2 answers
4k views

I need to know what is the purpose of using service container's tagging and how to use it by example this is what I have tried so far. class MemoryReport { } class SpeedReport { } class ...
Mohamed Azzam's user avatar
9 votes
2 answers
20k views

Need to understand Laravel service container and service provider through an example.
Ravinesh's user avatar
  • 125
-7 votes
1 answer
113 views

I have a confusion in the Laravel service Provider and Laravel container. In Laravel, how do service providers and containers work? Please give me a suitable example on it.
Prateek kumar's user avatar
1 vote
1 answer
859 views

I read this documentation about Service Container and also some other information on youtube but still not fully understand what is Service Container and how or when to use it so please if you can ...
zac's user avatar
  • 5,028
0 votes
1 answer
800 views

Ok, I've watched the Laracast videos on the topic and also have read the documentation, still I miss the core point here. Let's say we have the following structure: So I understood how to create a ...
user3102290's user avatar
3 votes
1 answer
3k views

In Laravel to access query, we use DB facades DB::select() from alanstorm website http://alanstorm.com/binding_objects_as_laravel_services I learned that DB facade use callstatic method that lead to ...
Jsnow's user avatar
  • 375
5 votes
2 answers
12k views

My error message: Illuminate \ Container \ BindingResolutionException Target [Project\Backend\Service\Validation\ValidableInterface] is not instantiable. I understand that interfaces and abstract ...
noobmaster69's user avatar
  • 3,115