I learned a lot from your videos regarding code standards and all. You are doing such great work. Thank you Povilas for giving your contribution to the laravel community. Great work. Keep it up.
Can't believe this was from 3 months ago and I missed it. Looks like a great project, well done that developer. One thing I was surprised you didn't mention was the importance of using config variables rather than env ones direct, because once you go to a production environment you should really be running config:cache, at which point all the env based bits stop working.
Wait really? This is the first I've heard of that... Almost all projects I've came across just says to use the env file I read the Laravel docs and it says that's only to speed up the application, doesn't say it's good practice or anything
@@JamesAutoDude I think anything that has to access and read a file could be deemed slow, better to cache it to redis or something. I also found that locally on windows when running Apache, if you have a page which on load immediately performs say 2 API calls to the server. The .env file will be locked presumably by windows from the first call, and it causes laravel to return a 500 error. Only way I found to get around this locally was to cache the config. Which if you're using the file driver makes no sense, but somehow seems to resolve it.
@@AndyTalbot uhhh you do know that cache is reading a file right 😬 websites general are nothing but files... I'd have to disagree as I have big applications and even tried huge Laravel projects,a they were blazing fast using just the .env
@@JamesAutoDude redis isn't files is it? That's memory based I thought. But yes otherwise file based caching should in theory still be the same problem as the .env I think windows based Apache might be a bit odd and doing some kind of blocking.
09:30 line 52: should go to FormRequest->authorize (user->can('create_project') or route middleware (can:create_project) line 58, 59, 60: not needed line 61: should go to static boot of Models\Project. Something like that: static::creating( fn ($project) => $project->created_by_id = auth()->id() ); Also, it advised to pass the guard to auth() since he/she's probably implementing multi guard authentication.
Interesting. Events/Listeners are great as well. And they focus on things where one event can be used to fire different Listeners. You said to use Job as they are queueable. But the fact is Event is only fired. And most time consuming things are done in Listeners (which are obviously queueable)
Thanks, damn, I miss those things from time to time. Edited the video, TH-cam is processing the changes now. Thanks for reporting, I need to be more careful.
Is it possible to make a tutorial with multi-databases and multi-tenants but always keeping the same base URL and not putting in the URL the subdomain ? For example my domain is project.test and from project.test/login I can identify which tenant I belong to without placing a subdomain of the account.
Super interesting, thanks for this review. I noticed in the mapTenantRoutes function a reference to subdomain and saw that the subdomain was not used in the tenant routes file to wrap the routes. My question is, where comes from the subdomain value? Thanks!
Hi, I have a web application built on Laravel for document management with an integration with CSC API from where I get a hashed signature. I am wondering if you have a solution for adding this signature to the pdf. I don't have access to the private or public keys, they are stored in the cloud and the certificate as well. Thank you
A question please, Since this project is using subdomains to get the database name, do you have any idea on how to get the right database in case we connect this project to a mobile app using a REST API ?
@@LaravelDaily Without a doubt between listeners and observers is a personal preference, however I reformulated that part of the project to use queues and came to the conclusion that jobs must be used, for the simple reason that in queue, listeners are not used chaining, which sometimes caused error because the migrations listener was triggered before the database was created. With jobs and queue chains this problem is solved, because we can chain jobs and the second is triggered only when the first one finishes successfully.
Very interesting, a course of this topic multitenancy saas, would be a very good one, i'm willing to buy the yearly membership, maybe this idea of new course can be a thing
laraveldaily.teachable.com/p/creating-laravel-saas-with-cashier-stripe I have a SaaS course, MultiTenancy is one of the lessons there, from what I remember
For database name as a question or suggestion! - How do you think, to use some generated text from backends like: project id, or timestamp, or random string ( of course validating before if necessary) Also, there is a point in 5:30 with setConnection with a project id, looks like multitenancy is custom if it's possible to take a look at that connection if there is a used multi user or everything is running under the main database user. I found a good package from spatie spatie.be/docs/laravel-multitenancy/v2/installation/using-multiple-databases but didn't check it yet sorry if I repeated some else's question and hope not to disturb you ^_^ nice job
Yes, to be honest, I would use one of the available multi tenancy packages instead of doing it manually. Probably should have mentioned this in the video.
i use wz.cz ... in their file manager one can unzip package. commands can be run by simple routes. BE VERY CAREFULL WITH THAT. secure everything. it's easies to migrate localy and import db struct through sql manager. there might be issue with rewrite ... check hosting q&a or ask CS ;)
Make a new laravel project on local machine, then run composer require without --dev, run migrations. Then upload everything on shared hosting and export/import mysql databases separately. Here you go - everything running. The problem is only with artisan commands - you don't have access to a console - so you can't run artisan commands. Everything else runs great. Tested bagillion times. Laravel can be run on shared hosting, but I'd recommend only really small projects to run on that. Since when the time comes to update your project - it will be VERY uncomfortable to do that. Oh yeah, forgot to mention that all your QUEUED JOBS won't work at all, since the listener won't work as well. So forget about queued jobs too
The way you read and breakdown the codebase is like a Symphony performance... Thankx for the video
Overall the code was amazing and your review tought me like hundred new thing
Just wow
I learned a lot from your videos regarding code standards and all. You are doing such great work. Thank you Povilas for giving your contribution to the laravel community. Great work. Keep it up.
Can't believe this was from 3 months ago and I missed it. Looks like a great project, well done that developer. One thing I was surprised you didn't mention was the importance of using config variables rather than env ones direct, because once you go to a production environment you should really be running config:cache, at which point all the env based bits stop working.
Wait really? This is the first I've heard of that... Almost all projects I've came across just says to use the env file
I read the Laravel docs and it says that's only to speed up the application, doesn't say it's good practice or anything
@@JamesAutoDude I think anything that has to access and read a file could be deemed slow, better to cache it to redis or something.
I also found that locally on windows when running Apache, if you have a page which on load immediately performs say 2 API calls to the server. The .env file will be locked presumably by windows from the first call, and it causes laravel to return a 500 error. Only way I found to get around this locally was to cache the config. Which if you're using the file driver makes no sense, but somehow seems to resolve it.
@@AndyTalbot uhhh you do know that cache is reading a file right 😬 websites general are nothing but files... I'd have to disagree as I have big applications and even tried huge Laravel projects,a they were blazing fast using just the .env
@@JamesAutoDude redis isn't files is it? That's memory based I thought. But yes otherwise file based caching should in theory still be the same problem as the .env I think windows based Apache might be a bit odd and doing some kind of blocking.
Good review as always. And very nice work done by this developer.
That was a good breakdown
09:30
line 52: should go to FormRequest->authorize (user->can('create_project') or route middleware (can:create_project)
line 58, 59, 60: not needed
line 61: should go to static boot of Models\Project. Something like that: static::creating( fn ($project) => $project->created_by_id = auth()->id() );
Also, it advised to pass the guard to auth() since he/she's probably implementing multi guard authentication.
thats review of code make me understand to make each other can read my code
Can you create tests for GitHub CI in multiple sub domain?
If you were to run a migration in a job, how would you do that?
What if a job fails, how do you catch the exception and display the error.
Great review
Thanks a lot for that advices, that a good point of view for everyone
thanks , do you suggest a specific multi tenant package to use ?
How do you set your database connection for each tenant?
Interesting.
Events/Listeners are great as well.
And they focus on things where one event can be used to fire different Listeners.
You said to use Job as they are queueable.
But the fact is Event is only fired. And most time consuming things are done in Listeners (which are obviously queueable)
Hi, you have censored the information of the person who sent the email, but the email address appears in the search bar of the browser.
Thanks, damn, I miss those things from time to time. Edited the video, TH-cam is processing the changes now. Thanks for reporting, I need to be more careful.
@@LaravelDaily Hi Povilas, I'm the author... is not problem with that.
@@pauloamserrano nice job
@@pauloamserrano good job man. Is the project open source or a client. There's a lot of things I'd like to learn from that codebase
@@igbokwelaurence5882 email me. pauloamserrano@gmail.com
Very Nice, and touch many ways of do it same thing.
This is really amazing. It helps me a lot
Thanks for the review, Using this pattern, is there a way we can scale up for a single tenant?
Can we use fqdn example.test instead of subdomains?
Is it possible to make a tutorial with multi-databases and multi-tenants but always keeping the same base URL and not putting in the URL the subdomain ? For example my domain is project.test and from project.test/login I can identify which tenant I belong to without placing a subdomain of the account.
Super interesting, thanks for this review. I noticed in the mapTenantRoutes function a reference to subdomain and saw that the subdomain was not used in the tenant routes file to wrap the routes. My question is, where comes from the subdomain value? Thanks!
thank you it is very useful video
Hi!
Why events? isnt it easier to use observer? and call queue from observer
Hi,
I have a web application built on Laravel for document management with an integration with CSC API from where I get a hashed signature. I am wondering if you have a solution for adding this signature to the pdf. I don't have access to the private or public keys, they are stored in the cloud and the certificate as well.
Thank you
Sorry I haven't worked with such projects or CSC API, so I have no advice.
A question please,
Since this project is using subdomains to get the database name, do you have any idea on how to get the right database in case we connect this project to a mobile app using a REST API ?
@Ahmed Safaa Thanks for your help!
What would be the differnce here between using a listener and a model observer which fires a job on create?
Personal preference.
@@LaravelDaily Without a doubt between listeners and observers is a personal preference, however I reformulated that part of the project to use queues and came to the conclusion that jobs must be used, for the simple reason that in queue, listeners are not used chaining, which sometimes caused error because the migrations listener was triggered before the database was created. With jobs and queue chains this problem is solved, because we can chain jobs and the second is triggered only when the first one finishes successfully.
Hi, can you please create video on laravel installation like cms WordPress and Drupal etc
Configure db details etc from browser form
How does it work for sub domain routing? Don’t we need to create separate DNS record for each subdomain on live servers like Route53?
You can wildcard subdomains
If you have project like this consider using cloudflare. They have php api so you can create subdomain. Wildcard is good for local testing.
All subdomain requests come to the same Laravel installation. The application then detects which subdomain the request was for.
Sir, know how to use the laravel telescope without migrate, because the database has been provided
Telescope has nothing to do with migrations, from what I understand. What functionality of telescope you want to use exactly?
Very interesting, a course of this topic multitenancy saas, would be a very good one, i'm willing to buy the yearly membership, maybe this idea of new course can be a thing
laraveldaily.teachable.com/p/creating-laravel-saas-with-cashier-stripe I have a SaaS course, MultiTenancy is one of the lessons there, from what I remember
@@LaravelDaily Hello sir, this course including create new database like this video? thanks.
You're the best!
For database name as a question or suggestion!
- How do you think, to use some generated text from backends like: project id, or timestamp, or random string ( of course validating before if necessary)
Also, there is a point in 5:30 with setConnection with a project id, looks like multitenancy is custom if it's possible to take a look at that connection if there is a used multi user or everything is running under the main database user.
I found a good package from spatie spatie.be/docs/laravel-multitenancy/v2/installation/using-multiple-databases
but didn't check it yet
sorry if I repeated some else's question and hope not to disturb you ^_^ nice job
Yes, to be honest, I would use one of the available multi tenancy packages instead of doing it manually. Probably should have mentioned this in the video.
Hello sir
Can you please provide the code to get some help about multi-tenancy?
Which code do you need? If you want the code of that specific repository, then I can't give you that, because it's not my code and it's not public.
@@LaravelDaily do you have any multi tenancy tutorial available Sir ?
how to upload laravel app in shared hosting
I don't recommend shared hosting for any Laravel project.
i use wz.cz ... in their file manager one can unzip package. commands can be run by simple routes. BE VERY CAREFULL WITH THAT. secure everything.
it's easies to migrate localy and import db struct through sql manager.
there might be issue with rewrite ... check hosting q&a or ask CS ;)
also... run composer before upload to get rid of dev packages. you don't need them.
Make a new laravel project on local machine, then run composer require without --dev, run migrations. Then upload everything on shared hosting and export/import mysql databases separately.
Here you go - everything running.
The problem is only with artisan commands - you don't have access to a console - so you can't run artisan commands. Everything else runs great. Tested bagillion times. Laravel can be run on shared hosting, but I'd recommend only really small projects to run on that. Since when the time comes to update your project - it will be VERY uncomfortable to do that.
Oh yeah, forgot to mention that all your QUEUED JOBS won't work at all, since the listener won't work as well. So forget about queued jobs too
Interesting
can i get a download link for this project.
No Because. Its someone else property
How the heck do you know all of this 😭 there's so many damn files with Laravel that I constantly get confused!
Practice. A lot of practice.
There is no tenent.php in config
It has been deleted looks soo
🤙
First, Thank you for content!
You are the best but I don't like you have mixed to many topics in one lesson.
Good content. However, as always you re too fast, it literally feels like you are flexing instead of actually teaching or enlightening someone.