0 experience to go until the next level!
In case you were wondering, you earn Laracasts experience when you:
Earned once you have completed your first Laracasts lesson.
Earned once you have earned your first 1000 experience points.
Earned when you have been with Laracasts for 1 year.
Earned when you have been with Laracasts for 2 years.
Earned when you have been with Laracasts for 3 years.
Earned when you have been with Laracasts for 4 years.
Earned when you have been with Laracasts for 5 years.
Earned when at least one Laracasts series has been fully completed.
Earned after your first post on the Laracasts forum.
Earned once 100 Laracasts lessons have been completed.
Earned once you receive your first "Best Reply" award on the Laracasts forum.
Earned if you are a paying Laracasts subscriber.
Earned if you have a lifetime subscription to Laracasts.
Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.
Earned once you have achieved 500 forum replies.
Earned once your experience points passes 100,000.
Earned once your experience points hits 10,000.
Earned once 1000 Laracasts lessons have been completed.
Earned once your "Best Reply" award count is 100 or more.
Earned once your experience points passes 1 million.
Earned once your experience points ranks in the top 50 of all Laracasts users.
Earned once your experience points ranks in the top 10 of all Laracasts users.
Awarded Best Reply on Wunderlist Clone - Database
Well, if you really want to do this good you should store the repeating pattern in the database and based on that determine the next due date. You can then save the current next due date on your to-do item and use the repeating pattern that is stored in the database to determine the next one.
You can find some good examples here: https://stackoverflow.com/questions/5183630/calendar-recurring-repeating-events-best-storage-method
Replied to Wunderlist Clone - Database
Well, if you really want to do this good you should store the repeating pattern in the database and based on that determine the next due date. You can then save the current next due date on your to-do item and use the repeating pattern that is stored in the database to determine the next one.
You can find some good examples here: https://stackoverflow.com/questions/5183630/calendar-recurring-repeating-events-best-storage-method
Replied to Laravel Secrets - New Book By Bobby Bouwmann
@aurawindsurfing Thanks for sharing it here! Really appreciate it!
Replied to Laravel Secrets - New Book By Bobby Bouwmann
That should be fixed now! Seemed to be a CSS issue somehow.
Replied to Is There A Way To Use @push And @yield For Complex Laravel Blade Layout?
What you're trying to achieve should be done with stacks
since it's possible that you need to add multiple styles or scripts.
Documentation: https://laravel.com/docs/8.x/blade#stacks
Your component should extend the layout in some way to make this work. Can you show how a component looks like and uses the main layout?
Replied to Laravel, VueJs, Pusher - Chat App
Well, it seems your Laravel part is correct here. You broadcast it to a channel name. The only thing I can imagine is that you either are not authenticated correctly in your frontend, because you use a private channel. The other option could be that you're listening to the wrong channel in the frontend.
Can you show some parts of your frontend?
Replied to Store Token
This can be done in a few ways and it depends on how much effort you want to put into it. Most importantly is that your token should be short-lived. This means it will expire in an hour for example. You will then have to get a new token once the token has expired.
In React you can store it in a cookie or in a worker. Make sure you encrypt the token so it won't be usable if someone does get the token.
Awarded Best Reply on How To Handle Soft Deletes With Daisy Chained Tables/models?
Eloquent itself doesn't have functionality for it, but your models do throw events. So what you can do is hook into the delete event on the invoice model and perform your action there
You can find this approach here in the documentation: https://laravel.com/docs/8.x/eloquent#events-using-closures
You can also do this in a dedicated class as you can find here: https://laravel.com/docs/8.x/eloquent#observers
Awarded Best Reply on Eager Load When It Has Relationship
You need to use a combination of with
and whereHas
here
// Only get comments that actually have one or more posts
$comments = Comment::whereHas('posts')->get();
// Get all comments including the posts that have one or more posts
$comments = Comment::with('posts')->whereHas('posts')->get();
Replied to How To Handle Soft Deletes With Daisy Chained Tables/models?
Eloquent itself doesn't have functionality for it, but your models do throw events. So what you can do is hook into the delete event on the invoice model and perform your action there
You can find this approach here in the documentation: https://laravel.com/docs/8.x/eloquent#events-using-closures
You can also do this in a dedicated class as you can find here: https://laravel.com/docs/8.x/eloquent#observers
Replied to Error When Running Npm Install && Npm Run Dev
Normally it helps just deleting the node_modules
directory and running it again. If that doesn't work try deleting the package-lock.json
and run the command again.
Your final option is to clear the cache from npm
rm -rf node_modules
rm -rf package-lock.json
npm cache clean --force
npm install && npm run dev
Replied to Eager Load When It Has Relationship
You need to use a combination of with
and whereHas
here
// Only get comments that actually have one or more posts
$comments = Comment::whereHas('posts')->get();
// Get all comments including the posts that have one or more posts
$comments = Comment::with('posts')->whereHas('posts')->get();
Replied to Failed Deployment Using Forge.. "your Local Changes Will Be Overwritten "
@aurawindsurfing You shouldn't have these issues if you don't change files directly on the server. A deployment should always be done on forge by pulling the code and that's it. If you update files on your own git gets out of sync.
It can also happen that you have a log or cache file in source control which being updated after deployment or when running your application and therefore git gets out of sync.
Replied to A SOLID Exercise I Need Help With
@shmdesign Yeah, this is a tough one to answer without knowing what you understand and what you need.
I would personally start with an interface and go from there ;)
Good luck with helping @lacasera ;)
Awarded Best Reply on Database Notification Not Getting In Admin Dashboard In Laravel 8 How To Solve
The problem is that you reference $notifications
with the extra s
while you should be using
$notification->data['data']
Replied to Token Based Authentication Vs JWT Or Passport Laravel
Well, there is a big difference between using them and you decide which one you want to use based on the communication you need. If you're building a very in-application API the api_token
approach might be good enough for you.
If you need to authenticate multiple other applications or they need to authenticate through you, you're better off with passport.
So what exactly are you building? That decides which authentication technique you should use ;)
Replied to Notifying Subscribers
What have you tried so far?
To be it sounds you already have a list of subscribers you want to notify. After that, you only need to loop over these subscribers and notify them. Or am I missing something?
Replied to Laravel Logging Permissions
The log file is created by the user that is running the application. So if your web server creates the log file, that should also be the owner. if it's created by running a command with php artisan or something else, it could be that it's created by that user.
The integer 0664
should work here, so no string.
Replied to Best Laravel Project Setup
Well, this is a tough question because every project is different. It already depends on how much people work on it, what the budget is, and if there is a deadline. Depending on all those things, you can create a plan and start working.
What exactly are you looking for? Is it tools? Or is it project planning? Or is it default packages you can use?
Replied to Database Notification Not Getting In Admin Dashboard In Laravel 8 How To Solve
The problem is that you reference $notifications
with the extra s
while you should be using
$notification->data['data']
Awarded Best Reply on Laravel Signed URL's With Subdomain
You can pass in a 4th parameter to get the absolute or relative url. By default this parameter is set to true. If you set it to false it will only return the url without the domain. You can then prefix it with the url yourself. You can for example get this value from the APP_URL or from some other config you're using ;)
$url = Url::temporarySignedRoute('viewProof', now()->addWeek(), ['proof' => $proof->id], false);
Replied to Popup With Multiple Pictures From Imgur
Well, if you have the URL to the image you can simply create a new image tab and put the URL in the src attribute of the img
tag. You can do this with regular JS or with any other JS library
Without much more details this is hard to explain
Replied to Does Laravel Nova Support Php 8.0?
Well, Laravel 8 is just out so there might be some dependencies for Laravel Nova that aren't ready for PHP 8 just yet. Give the team some time to work on the compatibility. They will tweet or send an email once this is available ;)
You can try to install it by using the --ignore-platform-reqs
flag. However, it could break something in Nova.
Replied to I Need Please Some Ressources Or Code Sources Or Videos
You can do the calls using an API route, right? The face recognition you use is through an API
Replied to I Need Please Some Ressources Or Code Sources Or Videos
Here you go: https://www.freecodecamp.org/news/easy-facial-detection-in-your-laravel-php-application-11664ac9c9b9/
Or you a simpler package, but with fewer features: https://github.com/softon/laravel-face-detect
Replied to Edit Function In Livewire Create Another Piece Of Data
That's very unclear... We need at least some code to understand what's going on here..
Awarded Best Reply on How Queue Workers Works Under The Hood ?
It's basically a never-ending process because it keeps listening for the next job. If it can't find any, it simply sleeps for x seconds.
You can read more about the code here: https://github.com/laravel/framework/blob/8.x/src/Illuminate/Queue/Worker.php#L297
If you run the daemon
option (running it in the background) it uses a while(true)
never-ending loop. You can find that code here: https://github.com/laravel/framework/blob/8.x/src/Illuminate/Queue/Worker.php#L117
But yeah, basically an infinite loop ;)
Replied to Laravel Nova: Delete Images From Disk When Content Is Modified And Image Is Removed
@frazecolder This is the only documentation I know: https://nova.laravel.com/docs/3.0/installation.html
Replied to How Queue Workers Works Under The Hood ?
It's basically a never-ending process because it keeps listening for the next job. If it can't find any, it simply sleeps for x seconds.
You can read more about the code here: https://github.com/laravel/framework/blob/8.x/src/Illuminate/Queue/Worker.php#L297
If you run the daemon
option (running it in the background) it uses a while(true)
never-ending loop. You can find that code here: https://github.com/laravel/framework/blob/8.x/src/Illuminate/Queue/Worker.php#L117
But yeah, basically an infinite loop ;)
Replied to Laravel Nova: Delete Images From Disk When Content Is Modified And Image Is Removed
@frazecolder I don't think you can do that, because the event is triggered on the model itself.
If you need something like that, you should probably fire your own event in Nova and use that event to handle those extra cases.
Awarded Best Reply on Travel And Expense Management Database Schema
I would probably add the fields in the first place to the same table and make them nullable. Only if you start the additional fields for multiple declaration types you should consider refactoring it.
If you decide to do it right away, I would probably create a polymorphic relationship to create the different kinds of expenses that you can store.
In most cases, start with the simplest approach ;) Keeping it simple will benefit you in most cases in the long run.
Awarded Best Reply on Laravel Nova: Delete Images From Disk When Content Is Modified And Image Is Removed
You can use the saving
model event to modify the data before it's stored in the database. By using that in your observer or using the boot method of you're model, it should work for you ;)
Replied to Laravel Nova: Delete Images From Disk When Content Is Modified And Image Is Removed
You can use the saving
model event to modify the data before it's stored in the database. By using that in your observer or using the boot method of you're model, it should work for you ;)
Replied to Travel And Expense Management Database Schema
I would probably add the fields in the first place to the same table and make them nullable. Only if you start the additional fields for multiple declaration types you should consider refactoring it.
If you decide to do it right away, I would probably create a polymorphic relationship to create the different kinds of expenses that you can store.
In most cases, start with the simplest approach ;) Keeping it simple will benefit you in most cases in the long run.
Replied to Message: "CSRF Token Mismatch." Laravel
You specify a CSRF token twice here, first in the headers, and then also in the _data
key. It could be that one of the tokens is incorrect and therefore it fails. Start with trying one of the approaches instead of both.
Replied to Laravel Sanctum Returns 500 When Trying To Access Sanctum Protected API
Yeah, Laravel automatically assumes you use a bigInteger for the id
column of the users
table. You can use something else like a UUID, but you would need to override a lot of things in Laravel.
Instead, I would recommend you to keep the bigInteger
for the id
column in your users
table and use an additional uuid
column that you can use in the rest of your application.
In this case, you're working too much against the framework defaults that it takes a lot more time to rebuild all those tables and refactor parts of the packages that it's better to use a normal ID.
Note that Sanctum is a way to get started easily, this is really an edge case situation in which the package doesn't provide.
Replied to Composer Wont Extract Files
Well, if you look at the path you can see that the path is incorrect for a windows machine.
You can try to clear your composer cache first by running composer clearcache
and then composer install
again. You can also try to remove your vendor
directory completely and run composer install
again.
Replied to Composer Package Issue
Mmh, it seems it can't find some file on packagist, the place where all packages are hosted.
This first thing I would try is running composer clear-cache
. It could be that something has changed on one of the repos which are pointing to a different URL now
If that doesn't work you can remove your vendor
directory and compoer.lock
file and run composer install
again and see what happens.
Awarded Best Reply on User Registration Using Vue
@premisoft Please show your controller. You probably still have something in there that doesn't belong htere.
Replied to Laravel Nova Action Progress Indication
This is a pretty big question because Laravel Nova itself doesn't support this. The actions itself always return only one response, so you can't handle it using that approach.
An alternative solution is redirecting the user to a page in Nova where you can show the processing part. You then also need to set up a queue that will handle all the invoices. Based on the data in the database you can decide how many of the invoices have been generated and display it on that page. You can create your own Nova tool that will handle the ajax requests for you, so you can poll it every x seconds or use web sockets to keep track of the count.
There is no a few lines of code solution for you here. You have to remember that Nova works for 80% of the cases and this is not one of them.
Replied to REST API Design For HasMany POST/PUT
I would put the foreign key in the body of your request. So something like this
POST /api/vX/workouts
{
"name": "",
"exercise_ids": [ 14, 454, 78, 1 ]
}
With a simple array, you only need to send the IDs. That should be good enough in your case ;)
Replied to Performance Of WhereHas Laravel
You can replace it using a join instead. If you use a join, you can replace the with
and whereHas
as well. However, you will get a different structure object than you might want to have.
Looking at your controller code, I would recommend limiting the number of results you return. Use ajax requests on the page itself to retrieve the related data or use pagination. This way the query will be a lot faster as well ;)
Replied to Spatie Media-Library - Resize Main Image While Adding It To Media
The media library package doesn't support this functionality.
The reason being is that the original image is needed to perform certain actions in the package. You can of course delete the original image yourself after you're done with upload but I wouldn't recommend that ;)
Awarded Best Reply on How To Organize Multiple Projects Into A Single Project ?
You could make separated directories per service in your app/Http/Controllers
directory. That should already be enough.
But as I understand it, you already have 4 projects. You can also combine them using an API and simply call the API on the homepage to get the service working. Otherwise, copy-pasting the controllers and models should already be enough ;)
Replied to The Token Could Not Be Parsed From The Request
It seems you're not providing the correct authentication token here. You have two options for that. Either as a header or part of the URL
For the header option, add this header
Authorization: Bearer {{ YOUR_TOKEN }}
Or using the URL
https://example.com/some-url?token={{ YOUR_TOKEN }}
Here are some people with the same issue: https://stackoverflow.com/questions/39218757/laravel-jwt-auth-the-token-could-not-be-parsed-from-the-request
Awarded Best Reply on Scraping Kijiji And FB Marketplace Data
Well, it depends on what you want to scrape from the specific websites. Those requirements determine what kind of package or API you need to use.
This is a good package for most use cases: https://github.com/spatie/crawler
Replied to Github Actions Push To Deploy
It looks like you configured the SSH key incorrectly. Did you add a secret for your SSH key? And did you copy in the correct value in there?
You can find some pointers here: https://github.com/appleboy/ssh-action/issues/6
Awarded Best Reply on Best Practice: Testing Nova Resources.
Yeah, Nova resources are a bit hard to test in the regular PHPUnit way.
The easiest way to write proper tests for this is by using Laravel Dusk. That is also how Laravel Nova itself is tested. You can assert certain things in the view and assert if actions do the correct thing. You can then verify in the database if everything was correct.
Another solution for example is doing a get request to the API call that is being called underwater for Nova itself and assert the response in there. However, Laravel Nova fires multiple API requests for once view, so you need to be aware of this.
Awarded Best Reply on Create L8 API - Not An SPA, No Passport Needed, Plain Old API
In older versions (5.8 for example) I could simply create an api_token field on the user's table and get cracking.
This approach should still work out of the box, as long as you set your auth guard to api
. You can see the token implementation from Laravel here: https://github.com/laravel/framework/blob/8.x/src/Illuminate/Auth/TokenGuard.php
Make sure you send the correct headers in Postman.
Accept: application/json
Content-Type: application/json
Earned once your experience points ranks in the top 10 of all Laracasts users.