wilk_randall

wilk_randall

Member Since 2 Years Ago

Experience Points 178,780
Experience Level 36

1,220 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 688
Lessons
Completed
Best Reply Awards 126
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.

10 Sep
6 days ago

wilk_randall left a reply on How To Add Css Inside {{ }}

I'm pretty sure the browser is going to ignore all the extra spaces in that string unless you change it to   characters instead.

09 Sep
1 week ago

wilk_randall left a reply on How To Validate Unique Rules On An Update

You need to import the class Rule into your FormRequest class.

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest\;
use Illuminate\Validation\Rule; // Add this line

class OrganizerUpdateRequest extends FormRequest
{
     ...
}

wilk_randall left a reply on Axios Patch Issue When Updating Model

Honestly I think it's really up to what you think is the best method to use. For me personally I like to use patch when I'm doing an update of a model. I'm not sure why laravel isn't able to read the data from a patch/put request like that but by mimicking how they add the _method hidden input in normal forms it is able to work. This article might explain things better than I can: https://blog.fullstacktraining.com/restful-api-design-post-vs-put-vs-patch/

wilk_randall left a reply on How To Validate Unique Rules On An Update

Whenever I use the unique rule, I create a new instance of it instead. Doing this makes it much easier to read and work with:

// Be sure to import the unique rule in your class
use Illuminate\Validation\Rule;

...

return [
    'website' => [
         'required',
         Rule::unique('organizers')
              ->ignore($this->id) // Replace '$this->id' with whatever you need here
    ]
];

wilk_randall left a reply on Axios Patch Issue When Updating Model

@chrisgrim You could have still used patch if you just added the _method key to the form data object and submitted it via post.

params.append('_method', 'PATCH');

axios.post(`${this.eventUrl}/${this.organizer.id}/organizer`, params, headers);

I know it's kind of clunky but I've found this to work whenever I want to use a patch or put request and need to send FormData through the request.

wilk_randall left a reply on Axios Patch Issue When Updating Model

Have you tried submitting the form with just a regular object instead of FormData?

03 Sep
1 week ago

wilk_randall left a reply on AJAX In Blade Template

If you're trying to access a php variable like that, it won't work since php has already executed. If you just need something simple like the id, you could just set a data attribute on the element like data-id="{{ $yourModel->id }}".

It's been a while since I've used jQuery, but I think you would be able to access that data attribute like this:

var id = $(this).attr('data-id');

wilk_randall left a reply on Code Style: Would You Define Constants For Each Column Of A Eloquent Model?

I personally would hate writing code like that. If you use an IDE like PhpStorm there are laravel packages out there that can generate phpdocs for your models automatically for you. With the docs, you also get a quick overview of the attributes the model has, as well as other things like relationships and query scopes. With an IDE, you'll also get useful things from this such as code completion and you will also be able to see the data types of the columns too (comes from the db)

31 Aug
2 weeks ago

wilk_randall left a reply on Displaying Money And Storing In Database

I usually like to store the amounts as an integer as cents (for USD). When retrieving the value just divide it by 100 and when storing just multiply by 100.

28 Aug
2 weeks ago

wilk_randall left a reply on Laravel 6.0 App.css

Okay makes sense. I was just curious.

wilk_randall left a reply on Laravel 6.0 App.css

Why wouldn't you just use npm and compile the files? It's a lot less effort than tracking down the links or downloading the files.

27 Aug
2 weeks ago

wilk_randall left a reply on Too Few Arguments To Function

If you want to use $search in a closure like that, you have to pass it in with use instead.

->where(function ($query) use ($search) {
    $query->orWhere('name', 'like', '%'.$search.'%')
    ...
});

Also what is the point of this:

$input = $request->all();

$group_id = @$input['group_id'];
$search = @input['search'];
$maxdata = @input['maxdata'];

IMO that is just a terrible way to write code. Wouldn't it make more sense to do it like this?

$group_id = $request->group_id;
$search = $request->search;
$maxdata = $request->maxdata;

// Or even just use the $request object directly instead of creating variables for each thing

wilk_randall left a reply on Click.prevent

Change the colon : to @.

16 Aug
1 month ago

wilk_randall left a reply on What's The Best Tool To Format Code In PHPStorm

You don't really need a plugin since you can adjust your code style settings for each language in the settings.

14 Aug
1 month ago

wilk_randall left a reply on How To Dispay Sweet Alert ?

@cronix Yea I've noticed that with this person. It's kind of ridiculous.

@siangboon I completely agree with that. I feel like they just don't care enough to learn and just want others to do the work for them.

13 Aug
1 month ago

wilk_randall left a reply on How To Dispay Sweet Alert ?

Haven't you already asked this a few times already?

12 Aug
1 month ago

wilk_randall left a reply on "Accountless" Edit Link

I think signed urls would work for what you're trying to do.

https://laravel.com/docs/5.8/urls#signed-urls

wilk_randall left a reply on Laravel Basics

It's pretty clear you don't know much about composer or the Laravel framework. Maybe you should try reading the documentation or watching some free videos on it here first.

https://laravel.com/docs/5.8

06 Aug
1 month ago

wilk_randall left a reply on How To Find Parent_id In Users Table

Like I and the others said, your query is looking for a parent_id on yourbuys table. All you need to do is add that column and foreign key to your buys table in your migration. Don't expect us to write the code for you.

wilk_randall left a reply on How To Find Parent_id In Users Table

Well you need that column in your buys table since that's where you're querying from.

wilk_randall left a reply on How To Find Parent_id In Users Table

Are you sure you have parent_id in your buys table because the error is saying it doesn't exist.

01 Aug
1 month ago

wilk_randall left a reply on HTML5 Validation With Vue.js Multi Form

I would wrap it in a form and make the next button a submit button. If the form submits successfully, increment to the next step.

On the form tag, it could look something like:

<form @submit.prevent="nextForm">
30 Jul
1 month ago

wilk_randall left a reply on Route Not Defined?

@munazzil

because can't keep any spaces between between like condition '%' . $q . '%'

Actually you can because you're not putting the spaces inside the strings being concatenated and for some people it's more readable that way. If you're going to give answers, you really should at least learn the stuff yourself before you give out incorrect information all the time. I'm not trying to be mean but your advice is just terrible. Please stop.

25 Jul
1 month ago

wilk_randall left a reply on Error Array To String Conversion In My Form

You could also just cast it to an array on your model and eliminate the need for implode.

18 Jul
1 month ago

wilk_randall left a reply on Run Artisan Commands On Production Server

You have to navigate to the directory where your project is on the server, and then run the commands you need to.

Example:

cd /home/myusername/my-project-url.com
php artisan cache:clear

wilk_randall left a reply on Conditions In Scopes?

Sounds like a whereHas would be more appropriate. You could even do it right in the scope you defined: return $query->whereHas('children');

17 Jul
1 month ago

wilk_randall left a reply on How To Obfuscate Ids?

Obfuscating an ID isn't going to make your application any more secure. It'd be better to perform the correct authorization checks for your resources instead.

If you don't want to expose the ID, I would just keep the id column and then add a uuid column that gets generated on user creation, which you could then expose and use that value to query for your users.

16 Jul
2 months ago

wilk_randall left a reply on Blade Echoing Returning 1

@snapey You make a good point. I usually use view composers to accomplish things like this but it's probably just a personal preference.

wilk_randall left a reply on How To Display An Element With Javascript

It seems you're trying to toggle a bootstrap class, but css isn't what you're looking for. Use $('#referral_code').toggleClass('d-block'); instead.

wilk_randall left a reply on Blade Echoing Returning 1

Is there a reason you're using view()->share() in a controller? If you only need it for one endpoint, I'd just send the data through when returning the view, otherwise I would use a view composer to share the variable with specific views.

https://laravel.com/docs/5.8/views#view-composers

As far as your variable goes, try using dd($body_class) to see what the value is, as I'm guessing it's a boolean value.

wilk_randall left a reply on Success Notification Best Practice

I think it's really up to you and what works best for you. I personally like to return the message from the server since I usually will use language lines for my messages.

15 Jul
2 months ago

wilk_randall left a reply on Forge: Script For Adding Column To Production Database Table

It should work since you have composer install included in the script. Although it doesn't hurt to have dbal installed, I don't think you'll actually need it since I'm pretty sure you really only need it if you want to change column names or column definitions.

12 Jul
2 months ago

wilk_randall left a reply on Laravel Mail Working Locally But Not On Server

If you're using mailtrap, the port is typically 2525, but just check your settings and it will tell you which port to use, along with any other credentials you need to use.

wilk_randall left a reply on Not Getting The Same Result In Vue

@munazzil I'm sorry, but are you special or something? The php version has absolutely nothing to do with the error here and running those commands isn't going to fix the issue. Not mutating the prop value in the component is what will though.

11 Jul
2 months ago

wilk_randall left a reply on Sql Query Too Slow

Try not to use active record on search with that many records, rather use getPdo().

There is seriously no need to reach for a PDO instance directly in the majority of cases. If you structure you database correctly with the right indexes and also make your queries efficient then Eloquent will do just fine.

wilk_randall left a reply on Error While Storing Route ID

oh its a token i guess

No it's not. _token is almost always the csrf token generated by the framework, which you shouldn't be using for any id. Unless value is your id, which by the looks of it it's not, you're not including the id in form or in the url.

If you have the id as part of your endpoint, you can just pass that in to the controller method and access it from there:

public function store(Request $request, $id)
{
   ...
   $review->restaurant_id = $id;
}

This would require you to have a route with something like this:

// Of course change the route signature to your needs
Route::post('reviews/{id}/store', '[email protected]');

wilk_randall left a reply on Not Getting The Same Result In Vue

The error you're getting doesn't really have anything to do with your environment. Make sure in whatever component you have a prop called selected_parent in that you're not modifying that prop's value anywhere in it.

09 Jul
2 months ago

wilk_randall left a reply on Laravel Forge On VPS With WHM

@haykd I say "appears" because that OS is the only option they give you when creating a new server or using a custom VPS, so I'm guessing it's "official".

wilk_randall left a reply on Laravel Forge On VPS With WHM

It appears that forge only supports Ubuntu 18.04 at this time.

04 Jul
2 months ago

wilk_randall left a reply on NPM Run Prod In Forge

Hmm, maybe try running npm clean-install and then try running the command again.

03 Jul
2 months ago

wilk_randall left a reply on How Html Developer Can Work With Live Site?

@roborobok I agree. You can't really do much with just HTML and CSS alone, so knowing a server side language/framework and/or client side languages will make you more marketable and allows you to develop much more comprehensive sites.

wilk_randall left a reply on Increment Attribute Value By Vue

I would just use the index of the current iteration for the name. There's no need for regex or whatever else you're doing.

<input v-for="(input, index) in inputs" 
        :name="`tag[${index}]`"
        :key="index"
        v-model="input.value"
>

wilk_randall left a reply on NPM Run Prod In Forge

Try checking your log files for more information.

wilk_randall left a reply on 413 Request Entity Too Large ( When Uplaoding Image )

Are you sure you're editing the correct php configuration file? You can run php --ini to check.

wilk_randall left a reply on Call To Undefined Method Error

@munazzil that just isn't correct at all. Where do you even get this information from??

wilk_randall left a reply on How Html Developer Can Work With Live Site?

Either make the developer learn Vue or find someone who already knows it.

02 Jul
2 months ago

wilk_randall left a reply on HOW TO CONNECT TO MY SERVER FROM FILEZILLA

Forge disables password authentication by default, so you need to use a public/private ssh key pair to connect to it.

30 Jun
2 months ago

wilk_randall left a reply on Meaning Of $name => $value When Iterating Arrays

Typically you use $name => $value when iterating over an associative array, where $name would be the key and $value would be the value of the current element in the array. You can use this same syntax on indexed arrays as well, where $name would be the index of the current array element in this case.

https://www.w3schools.com/php/php_arrays.asp