No Artisan Command for make:service? What To Do?

preview_player
Показать описание
There are some files that we need to generate and there's no Laravel Artisan command make:xyz for it. Let me show you how to deal with this.

- - - - -
Support the channel by checking out my products:

- - - - -
Other places to follow:
Рекомендации по теме
Комментарии
Автор

I used to create these classes via Editor as you did. Creating a Custom template is a great idea as well.

yaad
Автор

I think there's some value in making a command+stub for it, if you're working on a project with multiple people. By creating a new artisan make command you can make it easy for everyone to be consistent in how you do things. (I was inspired by the earlier controversy about controller return types. When the outcome of that was "customize stubs in your project" I started experimenting.)

laubannenberg
Автор

I use PhpStorm but most of the time it’s the fastest to just copy (F5) an existing file, refactor/rename the classname and replace the content I don’t need. When it’s the first file of it’s kind I just write these 5 lines myself 😂
Works in VsCode as well 🤓

JNL
Автор

For a project I'm currently working on, I work with actions alot, so I created a stub and an action command to achieve that, now am considering adding one for services as well.

Mrlordwhyte
Автор

That's a great informative video. I thought you’re gonna show us making stubs and custom artisan commands to achieve those. However, I've uninstalled Phpstorm last week because I was a bit overwhelmed and I'm used to VS Code more than Phpstorm.

alnahian
Автор

I usually make my own artisan command to create a service class

azzamydev
Автор

random question: what is the laravel logo next to the class name in phpstorm?

giacomogaravaglia
Автор

Is it possible to create a custom stub and asssociate it with an artisan command? Any guidance on that?

coolcha
Автор

Thanks, I'm appreciate your video. Great content.

I have a question, what do you prefer when you use repository pattern, do you still using service class or just use the repository in the controller? Thanks and I can't wait to see your thought.

huntwithmeid
Автор

👋,

Hello Povilas, congratulations on creating such enjoyable content for developers to watch! Building an audience on YouTube is no easy feat. I am curious to know why you have not yet monetized your videos as I haven’t seen any ads while watching them. I know you are a full-time Tech YouTuber, so I was wondering if there's a specific reason for not monetizing your videos?

❤🇮🇳

imrjat
Автор

Hi povilas,

I am using Laravel Breeze for authentication in one of my Project.

When the user forgets password, he can reset his password.

Can you please tell me How to pass user name in the default PasswordReset email template?

For Example, instead of Hello, you have requested for new password, I would like to show

"Hello {John Doe},

You have requested for new password.

rjeghgt
Автор

It's right that services are just standard classes, but what if you want to generate service and register it to interface into some provider? Of course this is easy, but why not to have a command to do it for you. Especially if the project is big with 20-30 domains and at least 20-30 service providers? Of course this is 30 minutes to make a command that can do it (I created package like this for my team and we use for all of my projects).

inso
Автор

In my opinion, the most universal solution for laravel would be if the creators of laravel added a command like:
php artisan make:class NameOfClass DestinationOfThisClass
with some parameters, for example:
--methods=function1:static, function2, function3:static.

Dreams... :)
php artisan make:class UserService Services --methods=getProfile:static, getCredentials:static
php artisan make:class UserAction Actions --methods=handle
etc.

bartoszgarlicki
Автор

If someone has tips on how to do this is vs code, appreciated

abdessamadelfathi
Автор

I just create them manually. We should not be lazy. And get those fingers typing.

mohamedkaddouri
Автор

why not just type two lines of code with the keyboard 🙂

OliverKurmis