Snapey

Member Since 4 Years Ago

Mansfield

at Novate / Microlise

Experience Points 1,360,075
Experience Level 50

0 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 1115
Lessons
Completed
Best Reply Awards 1932
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.

18 Jul
1 day ago

Snapey left a reply on What Is The Advantage Of Using Closures In Factories?

I guess in the closure you can perform more than one step and just return the value you want to use.

For instance, you might also want to add roles to the user that you are creating.

Snapey left a reply on Trying To Get Property Laravel

Great. Please mark best reply. Please also see my earlier answer about using null coalesce operator. Anytime you have $thing->otherthing->item you should worry about otherthing not existing. If you just try to access an attribute of otherthing and its not set then your code will crash.

Better to catch it with ?? and then a default for when its not set.

Snapey left a reply on Trying To Get Property Laravel

$table->unsignedBigInteger('progestudios_id');

should be singular

$table->unsignedBigInteger('progestudio_id');

Snapey left a reply on Artisan Queue:work Not Displaying Any Messages

In tinker run

>>> config('queue')

and study the result. How does Laravel think it is configured?

Snapey left a reply on ErrorException: Indirect Modification Of Overloaded Property App\Answer::$attribute Has No Effect

public function setAnsAttribute($ans)
{ 
    $this->attributes['ans'] = preg_replace('/@([^\s]+)/','LARACASTS_SNIPPET_PLACEHOLDER',$ans); 
}

attributes not attribute

Snapey left a reply on Composer Install Laravel 5.8.17 Instead 5.8.29

mark it answered please

Snapey left a reply on Wrong Output In Query For Id

anybodys guess!

Snapey left a reply on In Shared Hosting Environment, How To Hide .env File From Public?

Just make sure your web server ONLY serves the public folder. Don't try hacking it with .htaccess trickery or editing index.php

Snapey left a reply on XSS Prevention

purify the input so that only permitted html is passed through.

Consider https://github.com/mewebstudio/Purifier

Snapey left a reply on Blade Echoing Returning 1

resolved now?

Snapey left a reply on Trying To Get Property Laravel

OK, so most likely issue is one $mp that does not have a progrestudio

You should code defensively by using optional helper, or more simply, null coalesce

try

    @foreach ($mps as $mp)           
    <tr>
    <td>{{$mp->progestudio->nombre_pe ?? 'none'}}</td>
    <tr>
    @endforeach

Snapey left a reply on Trying To Get Property Laravel

hmm. It looks ok now

Snapey left a reply on Sending Notification On Successful Events

Its the User that is notifiable, not the order.

We need to see your OrderSuccessful class

Snapey left a reply on Trying To Get Property Laravel

Your relationships are wrong. Each Model should refer to the other model - not to itself

Snapey left a reply on Using A Number Sequence For A Quote Number

because the function exists inside the quote class. Here you are outside the quote class so unless you install this as a global helper, you need an instance of the model on which to call the function.

Snapey left a reply on Laravel Vue

mark best reply please

Snapey left a reply on Using A Number Sequence For A Quote Number

You should also be aware that there is a race condition here. If its possible that two users store a quote at the same time then there is a chance they will both get the same number

Snapey left a reply on Using A Number Sequence For A Quote Number

You say

['quote_number' => getNextOrderNumber] 

getNextOrderNumber is a function so it needs parenthesis

['quote_number' => getNextOrderNumber()] 

Snapey left a reply on Composer Requirements Conflict

Are you specifying specific (incompatible) versions of either package.

Help us help you by showing composer's complaint.

Snapey left a reply on Rollback Not Working As Intended

Thats exactly what the docs say

https://laravel.com/docs/5.8/database#database-transactions

But they also say you can to it manually with your own rollback and commit (as you have done)

They don't though example how you would use with try-catch block

I'm puzzled though

  • what will make these create statements fail?

  • why are you using echo

  • why are you using exit(1) in a web app

Snapey left a reply on I Want To Refresh The Section In Child Layout Without Using Ajax.

The replacement of the page content has to be done at the client.

The client has to request updated content from the server.

This is therefore a javascript problem, for which you need to use AJAX

17 Jul
2 days ago

Snapey left a reply on Method Illuminate\Database\Eloquent\Collection::delete Does Not Exist.

Sorry, try

$this->friends()->detach($user->id);

Snapey left a reply on Method Illuminate\Database\Eloquent\Collection::delete Does Not Exist.

The code you showed. Is it in your User model? You did not provide any context as to what $this is

Snapey left a reply on Blade Echoing Returning 1

Your or is being treated as a logical operator. Just change to ?? as suggested (much) earlier

Snapey left a reply on Blade Echoing Returning 1

You were right about not reading the documentation

The or Operator Likelihood Of Impact: High

The Blade "or" operator has been removed in favor of PHP's built-in ?? "null coalesce" operator, which has the same purpose and functionality:

Snapey left a reply on Method Illuminate\Database\Eloquent\Collection::delete Does Not Exist.

I assume your unfriend needs to just remove the relationship from the pivot table?

Using detach should be the way to go

something like

    $this->detach($user);

Snapey left a reply on Blade Echoing Returning 1

the or helper in blade files is deprecated as of 5.7

https://laravel.com/docs/5.7/upgrade (look under 'Blade')

Snapey left a reply on Feeback Towards The Courses?

You can feedback to Jeffrey in the discussion area at the bottom of the course itself.

Perhaps this might be of interest https://laraveldaily.com/test-junior-laravel-developer-sample-project/ (and the feedback below the article)

Snapey left a reply on If Condition Is Not Working

it's working for file and image coulumn not for file

?

Snapey left a reply on Blade Echoing Returning 1

just because it is a practice we have.

I assume then you are running on something like 5.5 since this is now deprecated?

Is there anything in the fact that you use two different methods to do the same thing?

    View::share('clients', $clients);
    view()->share('body_class',  'home');

Snapey left a reply on How To Obfuscate Ids?

a) your customer knowing the ID should be of no consequence. You should not rely on them not knowing it as some form of security

b) there are plenty of tutorials out there swapping IDs for UUID. I have no idea what "autogenerated every time means" and how it might impact your ability to create IDs for your models.

Snapey left a reply on Javascript D-block Not Working.

How do you expect this to work

    function showReferal() {
        document.querySelector('#referral_code').classList.remove('d-none');
        document.querySelector('#referral_code').classList.add('d-block');
    }

you change the class then you change it back.

Have you any programming skills at all?

Snapey left a reply on Safari Specific Date Input Bug

Much as I hate picky form inputs (eg credit card fields that don't allow spaces), in this case I would validate the field against a regex pattern and throw it back if not YYYY-MM-DD.

You then can guarantee that Carbon won't baulk at the presented format under any circumstances

It could be as simple as \d{4}-\d{2}-\d{2}

Snapey left a reply on How To Get A Specific Categories With Its Sub Categories Item?

unfortunately you need to iterate over the nested collections to pull all the ids

Snapey left a reply on Blade Echoing Returning 1

or is deprecated. I wonder if its that?

try null coalesce operator

<body class="{{ $body_class ?? '' }}">

Snapey left a reply on Javascript D-block Not Working.

This new question

Snapey left a reply on Filter Based On Checkbox Clicked

Don't use array syntax. Give each checkbox its own name.

Snapey left a reply on Javascript D-block Not Working.

Why start a new question....

Snapey left a reply on How To Get A Specific Categories With Its Sub Categories Item?

is your primary key id_category ?

You can load two levels like this, but if you need more levels then recursion might be required

Category::with('subcategories.subcategories')->where('category_name',  $category_name)->get();

but make sure the relationship works in tinker first

16 Jul
3 days ago

Snapey left a reply on Method Find() Not Working Properly

sounds like bugs waiting to happen. find only considers primary key and should match to IDs. If you pass it an object it will convert it to an array and try and use it to find records. How a string is interpreted in this case is anyones guess.

Snapey left a reply on Build Page Login Laravel

Your chances of success depend on how you stored the user's password in the first place.

Snapey left a reply on Asset() Work With Localhost , Not With Domain.local

do you have a file called icons?

Snapey left a reply on BelongsToMany

So i have a User class and License class with belongsToMany and hasMany relationships.

Also check your relationships. If its many-many with a pivot table then both models should be belongsToMany

Snapey left a reply on Laravel 5.8 Image Saves Into Tmp Directory

please mark best reply if it works now