Jaytee

Jaytee

Member Since 3 Years Ago

Christchurch, NZ

Software Developer at WSP Opus

Experience Points 115,685
Experience Level 24

4,315 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 472
Lessons
Completed
Best Reply Awards 114
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    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.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

19 Jul
3 days ago

Jaytee left a reply on Schedule:run Once A Day (at 00:00)

use ->dailyAt('00:00')

18 Jul
4 days ago

Jaytee left a reply on Feeback Towards The Courses?

Here is an older Archive series from Jeff. Some things have changed since then, however it might be useful to just watch along and understand how the fundamental courses are put into plan with a project.

https://laracasts.com/series/build-your-first-app-in-laravel

05 Jul
2 weeks ago

Jaytee left a reply on How Can I Have Custom Rule In A Pipe?

Keep it in the array format. It's easier to read

04 Jul
2 weeks ago

Jaytee left a reply on Can I Still Get Auth User After Redirects To Other Sites?

Yes. Their details are stored in the session, and the default authentication time is 2 hours.

Jaytee left a reply on Migration Error !!!

Refer to this article about fixing that error: https://laravel-news.com/laravel-5-4-key-too-long-error

Jaytee left a reply on How Long Is ONE Api Session?

So there are three answers to this:

  1. Using sessions (e.g: logging in not through an API). The session doesn't end when the user closes the tab, by default. It is an option in the configuration files tho. But the default session time is 2 hours.

  2. Your front-end API (e.g: a first-party app), instead of authenticating itself on every request, it will usually store a cookie, which I believe also uses the default session time of 2 hours.

  3. Using an API (e.g: third party), is stateless, thus auth is required on every request, therefore, yes, it is only valid for the one request.

Jaytee left a reply on Why Keys When Accessing A Cache

Caching is generally a key/value pair. The key is unique, and by searching that key, you then get the value.

Kind of like a database, in order to get a user by their id, you need to search them up by their unique id right? Same goes for caching. In order to get the cached value, you need to search it up by it's key.

02 Jul
2 weeks ago

Jaytee left a reply on What Div To Put The #app ID In My Blade Template.

Usually you add it to a div wrapper like you said, within the body tags. That way, even if the whole app doesn't require vue, you know you have access to it.

Jaytee left a reply on Laravel Ignoring Testing Database And Uses Main One Instead

Dump the autoloader

composer dump-autoload

01 Jul
3 weeks ago

Jaytee left a reply on Create Object Without Model

Ahh, so it appears the developer of the package doesn't know how to document/update their own packages.

This is the SearchParameters file: https://github.com/JolitaGrazyte/discogs-api/blob/master/src/SearchParameters.php

You'll need to call set{method} now instead of just calling {method}. E.G: setType instead of type

Jaytee left a reply on Create Object Without Model

You need to import the class at the top of the file. The namespace for it is:

use Jolita\DiscogsApi\SearchParameters

Jaytee left a reply on Class Config Does Not Exist In ....Illuminate\Container\Container.php:767

The first mistake is using Laravel Collective. It doesn't serve a useful purpose anymore, and it's better to write pure HTML forms now.

Remove the vendor folder and composer lock file, and re-install.

30 Jun
3 weeks ago

Jaytee left a reply on New Laravel Media Package

Nice work on creating a package, it's harder than some people think, and creating a package whether it serves useful or not, is a great achievement.

Now, down to being completely honest:

I don't see this being useful to developers out there. There are really no benefits to using this than over Spatie's package:

  1. The many-to-many relationship, I like that. However, it now involves using two tables for something that could still be used as one. In spatie's package, if we wanted global images/media, it's just as simple to setup a generic model like Site to serve as that purpose. It's sometimes better to make sure things are grouped, rather than global.

  2. Spatie also uses intervention/image underneath.

If you can add your own unique twist to this, whether it be improving the API for storing images, or adding something that the above two packages don't have, then I think you'll see a lot more use. Perhaps, add a client-side library to go with it which allows image manipulation as a GUI or something, i'm not too sure.

Jaytee left a reply on Webpack /Laravel Mix Scopes Get Messed Up - How To Fix?

I look up to @bobbybouwmann lmao. I'm only 1.2million XP behind you bobby ;)

29 Jun
3 weeks ago

Jaytee left a reply on Mix Cannot Find Dependencies For App.js And App.scss

@KASHOHEL - Don't bump old threads, and don't comment "it's working fine" or software that is two years old and has since been improved.

Jaytee left a reply on Call To Undefined Method Laravel\Lumen\Application::booting() Error In Lumen

As far as I can see, this package doesn't support Lumen. Not the most recent versions anyway.

Jaytee left a reply on Non-static Method Barryvdh\DomPDF\PDF::loadView() Should Not Be Called Statically

@AURAWINDSURFING - I'm not sure why anyone would want to use that approach in Laravel 5. app() and resolve() are helpers to App::make() and a facade doesn't need to be imported.

Use @bobbybouwmann 's approach, resolving it via the service container using the helper method.

Jaytee left a reply on Whenever I Reload My View It Show Me All Raw Data In Vuejs Laravel

You have two options:

  1. Add a loading spinner, which shows up until the content has loaded.

  2. Use v-cloak on the body (see vue documentation), which will hide everything until it has been loaded.

28 Jun
3 weeks ago

Jaytee left a reply on Testing Flash Messages And Redirects

Checkout the Laracasts flashing package, and see if you can understand how the tests are performed.

https://github.com/laracasts/flash/blob/master/tests/FlashTest.php

27 Jun
3 weeks ago

Jaytee left a reply on Seed Photo

Seeds are usually used with/without factories. They're used to populate data (whether it be real or fake, usually fake, but if you often need to seed static values, it can be used for that too) into the database.

The controller shouldn't call a seeder nor a factory.

Honestly, you don't need a seeder to generate some photos from faker, into the database. Just do something like

'file' => 'some-url-to-a-photo'

That's all you need really (unless you want different photos for testing).

Jaytee left a reply on Error Log Saying No Query Results Found But There Are Records

No worries dude, however I believe @talinon should have best answer for this. I was just explaining how jobs work and why you may receive errors :)

Jaytee left a reply on Error Log Saying No Query Results Found But There Are Records

No so what happens is, when you dispatch Jobs, it takes essentially the whole class/models and serializes them, then saves it in the database. Then when the job is run, is unserializes it from the database and builds that class up.

Remember, jobs are used to do stuff later on right? So if you think about it, we need a way to save the state of that class at that current time that we were dispatching the job, so that our application can continue executing everything else.

So whenever you make a change to those classes, it won't reflect, because the queue is still using values from the database. So that's why we flush the queue.

In general, it's good practice to flush the queue everytime you make a change to a class that is in use by a queue, UNLESS you know it isn't going to interfere with the job (e.g: adding a method, that the job doesn't use is fine).

Jaytee left a reply on Mix Is Compiling To Empty Js File

I haven't used Homestead in a loooonnnnggg time, I'm so glad I switched too because I used to always have issues with it. On mac, I use valet, and on windows, I now use Laragon (laragon is somewhat similar, it has it's own isolated environment).

Jaytee left a reply on What Are Good Datepickers For Laravel?

There are a variety of date/time pickers out there, but honestly, it depends on your requirements. Tempus Dominus works fine with a little configuration, but it has some issues, I agree.

If you need to support older browsers, then you'll need to use a package that supports modern browsers, and then user the user agent to determine whether to just show a plain datetime input or the package input etc.

Honestly, I stick with modern date/time pickers, I have no time for supporting older browsers anymore, so almost any vue / bootstrap 4 datepicker you come across will be fine, if that is your approach.

Jaytee left a reply on Laravel Passport- InvalidArgumentException: Route [login] Not Defined, When BearerToken Not Supplied.

You're getting this error because a named route login doesn't exist, for a GET request. You only have two routes, a register and login route which are POST requests.

Jaytee left a reply on Seed Photo

The issue is this line. Your ternary operator is incorrect.

<img height="50" src="{{$product->photo ? asset($product->photo->file) : '' . ' https://via.placeholder.com/100x100'}}" 

What you're saying here is, if we have a photo, get the photo, otherwise return an empty string... BUT THEN, concatenate another string (the placeholder url) on to it.

Jaytee left a reply on Test Troubleshooting / WAMP Laravel 5.8.26 W10

You haven't imported the Project model at the top of the file, thus it's trying to look for it in the tests folder instead.

Jaytee left a reply on Auth Guard Only Working For Default

  1. Don't modify any files that are in the vendor folder. That includes the trait you have modified. If you need to override a method, write it in the controller that is using the trait, using the same signatures/parameters that the original method uses. Whenever you next update, you will lose your changes.

  2. You're not telling the Auth to use your new guard. The Authenticatable class doesn't have a $guard property, and you're also not doing anything with that property.

You need to pass it to the guard method. e.g: $this->guard('employees')->attempt().....

Jaytee left a reply on Laravel Authentication With Middleware And Azure AD

From what I can see, what's happening is you're storing the user in the database, storing the user's id in the session, but you aren't actually logging in that user, thus Auth will return null.

You can log them in with something like Auth::login($user) where the $user is the newly created (or fetched from database if they already exist) object.

Jaytee left a reply on Laravel Mix Multiple File

append on to the mix file.

mix.sass('resources/sass/app.scss', 'public/css')
    .sass('resources/sass/blog.scss', 'public/css');

Jaytee left a reply on Mix Is Compiling To Empty Js File

@munazzil Literally once again, irrelevant. This isn't Laravel related, so clearing the cache for Laravel isn't going to make a difference.

@torch Have you got winnfsd installed or vagrant-winnfsd installed? The recommended one to install with Vagrant/Homestead is the vagrant-winnfsd. If you haven't got that installed, give it a shot and remove the regular winnfsd. If you have got it installed, I have a feeling it may be fucking with mix.

https://github.com/winnfsd/vagrant-winnfsd

Jaytee left a reply on Best Practice For Handling User Visiting Expired E-mail Verification Link?

I'm on 5.8, and after diving into the core code for verification, I can see there is a configuration option (not sure if 5.7 has this).

Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
26 Jun
3 weeks ago

Jaytee left a reply on Are View Composers Only For Static Queries?

View composers are used when the same data needs to be shared across multiple view files. Technically speaking, it can be dynamic or static data, however as far as I am aware, you cannot pass parameters to change the results, as these are setup in ServiceProviders.

For example (using this from a Laracasts video lesson): Imagine you have a navbar, and you want to show the title of the latest blog post.

The problem: In order for the navbar to receive the latest blog post, you would need to pass that blog post to every view that is rendered that includes the navbar, which in 99% of cases, would be every view. So for every method in your controller, you would do something like this:

// stuff that relates to this method

$latestPost = Post::latest()->first();

return view('my.view', compact('latestPost'));

Solution: Use a view composer to pass the $latestPost variable to the view that contains the navbar (e.g: app.blade.php or navbar.blade.php) so that the navbar has access to it

Jaytee left a reply on Mix Is Compiling To Empty Js File

@torch Sorry, not under minification. This one here: https://laravel-mix.com/docs/4.0/faq#im-using-a-vm-and-webpack-isnt-picking-up-my-file-changes

@munazzil That doesn't solve the problem. It's to do with NFS. Please, stop posting things that are irrelevant to the question. I understand you're new the forum and you want to help contribute, but contributing to questions with irrelevant answers doesn't help, and gets in the way of helping the original poster.

To make sure you're on topic, the issue here is using mix.js() with Laravel's Homestead and NFS file system on the Windows Operating System. Combining some files may work, but compiling files that need to run through webpack won't.

Jaytee left a reply on Mix Is Compiling To Empty Js File

Try looking at this here: https://laravel-mix.com/docs/4.0/faq

under the second FAQ question about minification. See if that will fix it with nfs

Jaytee left a reply on Mix Is Compiling To Empty Js File

Try update laravel mix. Package.json might be referencing 4.0.7 but node_modules may actually have a older version. 4.0.7 fixed compiling issues on windows, so it's possible that you're actually on a lower version, and it just didn't update. Best way to do it is remove laravel mix and re-install. Refer to the commands above that I posted if it fails to install.

Jaytee left a reply on Mix Is Compiling To Empty Js File

Shouldn't make a difference, but can you show us your app.js file and any other files like bootstrap.js please.

25 Jun
3 weeks ago

Jaytee left a reply on Mix Is Compiling To Empty Js File

Are you using dynamic imports with vue files? This could be the issue.

Jaytee left a reply on Mix Is Compiling To Empty Js File

You'll no doubt have issues installing node modules on Windows. It's always been like that.

Usually using yarn with --no-bin-links will resolve the issue of installing node_modules again.

@munazzil Once again, it's not related. We're talking about Laravel Mix compiling JavaScript, not Vue

Jaytee left a reply on Mix Is Compiling To Empty Js File

Try a couple things:

  1. Double check the file browser to make sure it's not just Windows playing games on you (I've had that before lol)

  2. Try removing and re-installing mix/node etc.

Jaytee left a reply on Mix Is Compiling To Empty Js File

@MUNAZZIL - That's not the issue here. OP is saying the file is empty. Including it isn't going to make a difference.

14 Jun
1 month ago

Jaytee left a reply on Too Few Arguments To Function App\Http\Controllers\ShowrecordController::index(), 0 Passed And Exactly 1 Expected

You're using resource routes. So by default, the index method doesn't accept any parameters. Index method is used for fetching all records, not a particular record (see RESTful).

You'll need to either manually write the routes using Route::get() and Route::post() or conform to REST standards. Ideally, your method above should be in the show method.

Jaytee left a reply on Updating Session After Login With Extra Values.

There are a couple of options:

  1. Flush the sessions, so that every user will need to re-authenticate. This will then trigger the authenticated method so you can set session data. If the session data changes periodically or based on conditions, then this may not be the best approach.

  2. You could possibly add a global middleware which is ran on every request. This middleware will check if a user is authenticated, and then handle the session. If they are not authenticated, then don't set the data (unless you want to do that)

Hooking into the login event probably won't work since that is only going to be fired when a user logs in I believe. I don't think this is fired on every request (although I may be wrong).

12 Jun
1 month ago

Jaytee left a reply on Adding A Step Before Registration

The controllers in the Auth folder all use traits. These traits have "hooks" so to say, to which you can perform actions before or after (or whatever you want). With a trait, you can obviously modify methods, just copy them over to that controller and modify as required. No need for middleware.

Jaytee left a reply on Cannot Login To My Live Application, No Logs On Laravel.log

TokenMismatchExceptions are usually thrown when you don't have a csrf token in your form. Check your authentication forms and make sure they're including a csrf token.

07 Jun
1 month ago

Jaytee left a reply on Easy Laravel Pre-defined Auth System

Ahhh, having authentication as an SPA doesn't matter. It's not something that your users often. Traditional pages works fine.

Creating a package for this might save you some time, but you can really only package the core functionality into a package since every project is going to be themed differently.

To be honest, it's not even a hassle. Dragging and dropping gets the job done, not sure why it takes you a day to setup authentication and the styles for it, that's a bit overkill, but hey, at least you're getting paid for it.

01 May
2 months ago

Jaytee left a reply on Created And Updated Events Are Both Fired For Model::create()

Yeah so the way it works is that the save method checks to see if the model should be created or updated (based on whether the model already exists etc), and then fire the respective event. I don't believe it fires both, it should fire one or the other.

13 Mar
4 months ago

Jaytee left a reply on How Can I Select Certain Fields Using With()

->with('children:id,name')->get()

Jaytee left a reply on Is There Technically Something Wrong With The "update Method" In This Controller?

There are a couple of things that can be changed, including one issue that is wrong.

  1. Index method, you could just use relationships instead of using the DB Facade to get courses belonging to the user. Setup a relationship on the user model so that you can do $courses = auth()->user()->courses

  2. You can get rid of the Auth:: facade and use a global helper auth()->id(). Just a simple improvement so you don't need to import anything and/or prefix it with \Auth::id()

  3. The edit method is taking in a course, but you're actually passing a collection to the view. ->get() returns a collection. That means you'd need to loop through $course which isn't correct. If you also setup a relationship, then you can once again remove the DB:: facade.

  4. In the update method, you have a $validated variable. You can just pass that to the ->update() method instead of doing update(['title' => $request->title]); etc. ->update($validated)