Xsecrets

Xsecrets

Member Since 4 Years Ago

Experience Points 63,045
Experience Level 13

1,955 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 617
Lessons
Completed
Best Reply Awards 5
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

14 May
1 month ago

Xsecrets left a reply on Eloquent Each Method Won't Return Any Value From The Collection

The only return that the each collection method accepts is false to stop processing. The way you are trying to do things is strange, but to get data from the dump I think you would want a map function instead of each.

08 May
1 month ago

Xsecrets left a reply on How To Improve The Speed Of A Laravel Page That That Queries For A Large Amount Of Data

  1. how long does the actual database query take? It might not be your issue.
  2. there is another thread on here somewhere that someone was using Aurora DB and accessing it via hostname which seemed to be the issue. From troubleshooting it looked like the dns lookup took up to 1600ms. It could well be that the dns lookup and connection to your db is taking up most of the time if you find from 1 that the query itself runs fast.

Xsecrets left a reply on ReflectionException Class App\Http\Controllers\User Does Not Exist

The initial error doesn't have anything to do with your controller. It's because you did not add a use statement for your User model, but then you tried to inject it in your functions like edit(User $user), so it looked in your current namespace for the class and it does not exist. To fix it at the top of the controller file with the other use statements add

use App\User;

That's assuming you are using the default User model.

30 Apr
1 month ago

Xsecrets left a reply on Deleting Parent Model Without Cascade

found in on stack overflow from a google search, actually two searches. I searched for sql on delete options then when I found the null option I searched for laravel foreign key on delete set null.

Xsecrets left a reply on Deleting Parent Model Without Cascade

->onDelete('set null');

Xsecrets left a reply on Help Needed With First Time Design

no guzzle uses sync not async, and it uses curl in the background to make the requests.

26 Apr
2 months ago

Xsecrets left a reply on All Tests Broke Down In The Cloned Version Of Project.

Well it's clearly some sort of mockery error. Are you using mocks in any of your tests? maybe looking at that code will reveal what is missing/different on the other machine

Xsecrets left a reply on All Tests Broke Down In The Cloned Version Of Project.

and you do have mocker/mockery in your dev dependencies in composer.json? I made the mistake of removing it once and got similar errors.

Xsecrets left a reply on All Tests Broke Down In The Cloned Version Of Project.

did you do composer install? if so make sure you did not use the --no-dev flag, because mockery is a dev dependency and required for tests

Xsecrets left a reply on Slow Queries/connections With Eloquent, Always Over 1600ms

yeah I don't know about aurora, but accessing the db from dns could cause the problems you are describing. because there will need to be a network call to get the ip for the db. if you can't use ip you could try editing the /etc/hosts file and adding that domain name in there to eliminate the network call and see if that helps.

Xsecrets left a reply on Laravel Forge - Nginx Respond On IP

I don't know how to do it off the bat, but if you spin up a new server and look at the default site that will answer on the ip so you should be able to look at that nginx file. I have removed all my default sites so I can't currently look.

23 Apr
2 months ago

Xsecrets left a reply on Creating A Contact Form Without Controllers And Migrations

If you really don't want to have a controller you could always send the mail in an anonymous function in your routes file, but the mail will need to be sent from the server not the client, so you can't really put it in blade.

04 Apr
2 months ago

Xsecrets left a reply on Can I Use One Middleware To Restrict Access To Multiple Routes?

of course. I generally create a route middleware, then in my routes file I create a group and apply the middleware to the group and put the individual routes inside the group.

Xsecrets left a reply on Overwrite Nginx Content-Security-Policy Within PHP?

sorry mixing up all the stupid web security stuff that starts with C. I don't know if you can overwrite headers set my nginx, but my gut instinct would be no you need to change it in the nginx config.

Xsecrets left a reply on Overwrite Nginx Content-Security-Policy Within PHP?

If you are a member the latest vue spa video covers this.

Xsecrets left a reply on Id Incrementation Problem

in mysql directly it would be something like ALTER TABLE MyTable AUTO_INCREMENT=100; not sure if that works on other databaes like postgres.

03 Apr
2 months ago

Xsecrets left a reply on Comparing Factory To Eloquent Model

@YOERIBOVEN - well from your code I don't see anywhere that you associate the settings with the user, so the false return from the is method is correct in this case. though I'm not sure what you are doing in the controller from that post. My guess is if you associate a setting with the user it's not the same setting you just created. If you do create a setting and associate it with the user in that controller and you are using refresh database trait so you know there is no other data in the database you could do the call then do something like $settings = Settings::all()->first(); My guess in this case if you do create one in your controller if you did Settings::all()->count() you would find out you have two when you would expect one.

Xsecrets left a reply on Comparing Factory To Eloquent Model

so if you had something like

$user = factory(User::class)->create();
$setting = factory(Setting::class)->create(['user_id' => $user->id]);
$this->assertTrue($setting->is($user->setting); 

should pass, and if you are creating the db entries in some other way shouldn't matter as long as $user and $setting are eloquent models it should work.

Xsecrets left a reply on Comparing Factory To Eloquent Model

Well you didn't show any code how anything was created so I don't really know what type of objects you have for $settings and $user, but if both of those are eloquent objects the comparison I posted should work.

Xsecrets left a reply on Vue Vs Jquery With Laravel... An Honest Performance And Easy Of Use Comparison

Yes in this instance basically the difference is that in the code you show you are returning html and adding that to the dom. With Vue you would simply return json data and update a variable and vue would take care of updating the dom for you. Honestly in my experience Vue does take a bit more setup code that jquery, however once you get into things of any complexity Vue starts using much less code than jquery. Plus I don't really like passing html like you have done, nor do I enjoy digging into and updating the dom through vanilla javascript from raw data.

Xsecrets left a reply on Comparing Factory To Eloquent Model

$this-assertTrue($settings->is($user->settings));

Xsecrets left a reply on General Question: How Do I Identify Where My Error Has Originated?

I would say the error has to do with this line. $data = DB::table('adjustments')->where(['toPID','=',auth()->user()->PID])->get(); the error is clearly from a select statement very similar to that. I would hard code auth()->user()->PID for testing to see if the error goes away, or log auth()->user()->PID to see if it contains what you think it does.

02 Apr
2 months ago

Xsecrets left a reply on Any Ideas How To Extract Certain Fields After A GroupBy() On A Collection?

oh sorry I didn't see that. So just move the groupBy before the get and it should work because groupBy is also a query method.

Xsecrets left a reply on Any Ideas How To Extract Certain Fields After A GroupBy() On A Collection?

so you want it grouped by scooter_id, but inside you only want lat/long? You should be able to simply remove scooter_id from the select.

Xsecrets left a reply on Accessing Localhost From My Iphone?

Well your phone can't access via localhost, but since you are on a macbook you might want to look into valet instead of php artisan serve. Valet has a share functionality that will give you a link your iphone can connect to.

07 Nov
7 months ago

Xsecrets left a reply on All Problems With The New Laracasts Design

I love the look of the new design, but I must say not having any sense of your completion level on the series browse or the watchlist is a bit of a pain.

18 Jun
1 year ago

Xsecrets left a reply on Data Property Not Being Updated From Created Method What Am I Doing Wrong

Thanks, that was it. I was actually in testing so a timeout without a time actually did it. I already had my test in a nextTick which I thought would be enough, but apparently not.

Xsecrets started a new conversation Data Property Not Being Updated From Created Method What Am I Doing Wrong

I have code similar to the following and it's not working. I just can't figure out why. I was thinking it was a scope issue, but as far as I can tell that is not the case.

<template>
    stuff here
</template>

<script>
    export default {
        props: {
            clientData: { default:null }
        },
        data () {
            return {
                client: this.clientData,
                clientList: 'initial value'
            }
        },
        methods: {
            fetchClientList() {
                window.axios.get("/clients").then(response => {
                    console.log(this); // returns vue component
                    console.log(this.clientList); // returns 'initial value'
                    this.clientList = response.data;
                    console.log(this.clientList); // returns proper data.
                });
            }
        },
        created() {
            if(!this.client) {
                console.log(this); // returns vue component matches the other one.
                console.log(this.clientList); // returns 'initial value'
                this.fetchClientList();
                console.log(this.clientList); // returns 'initial value' why is it not the valid data from above?
        }
    }
</script>

Any suggestions welcome.

04 Aug
3 years ago

Xsecrets left a reply on Is A Subscription To Cartalyst Worth It?

Most all of the platform specific packages are based on framework independent libraries/packages, pretty much all the functionality can be used framework independent if you take the time to put it all together.