wilk_randall

wilk_randall

Member Since 1 Year Ago

Experience Points 114,300
Experience
Level
Lessons Completed 509
Lessons
Completed
Best Reply Awards 95
Best Answer
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 Jan
4 days ago

wilk_randall left a reply on How To Reduce App.js?

@shadrix - Wasn't sure if that's what it was or not. Are you extracting all your vendor libraries? It seems like the vendor.js is relatively small.

wilk_randall left a reply on How To Reduce App.js?

If you're using webpack and laravel mix, you could use .extract()to extract your vendor libraries into a separate file, which might help

wilk_randall left a reply on Passing Multiple Data To Blade Template

Also, if you want certain variables always available to your layout, you should use a view composer instead of sending them in every controller.

13 Jan
5 days ago

wilk_randall left a reply on Using Filter Functions Inside V-html

You can accomplish that with mixins too

wilk_randall left a reply on Using Filter Functions Inside V-html

You could have just used a method on the component instead of a filter

10 Jan
1 week ago

wilk_randall left a reply on Location.href

Why wouldn't you just use a normal <a> tag? This makes no sense

09 Jan
1 week ago

wilk_randall left a reply on Create Password Reset Token Manually?

@mysadav - It is telling you your argument for the user is null. Make sure you actually have an instance of a user and that your user model implements Illuminate\Contracts\Auth\CanResetPassword before calling the createToken() method

07 Jan
1 week ago

wilk_randall left a reply on How To Add A New (custom) Function That Can Be Chained With The Auth() Function

@doejohn service providers are usually a good place for that kind of thing.

05 Jan
1 week ago

wilk_randall left a reply on How To Count Total Row Using Vue Js?

Your question is really vague, but assuming you have an array of items just find out how big the array is; it's just simple JavaScript.

console.log(this.items.length);
02 Jan
2 weeks ago

wilk_randall left a reply on Is It Good To Use $GLOBALS As Cache?

You're better off using Laravel's caching for queries: https://laravel.com/docs/5.7/cache

28 Dec
3 weeks ago

wilk_randall left a reply on Work Remotely With Laravel

Setting up shell access is on the server level and has nothing to do with the IDE itself. You would need to set this up according to your needs on the server and use those credentials to login via the terminal in the editor.

wilk_randall left a reply on Work Remotely With Laravel

They also give you a 30 day trial, so if you don't like it or it doesn't work for you, you haven't wasted any money on it.

wilk_randall left a reply on Work Remotely With Laravel

you really only need the single PHPStorm license.

wilk_randall left a reply on Work Remotely With Laravel

I'm not really sure on that since I don't use visual studio code, but I think it does have similar functionalities to PHPStorm. As far as how it handles stuff like that, I'm not sure on that.

wilk_randall left a reply on Work Remotely With Laravel

I don't think they offer a free version although they do offer discounts depending on your organization type I think. Terminal is already part of PHPStorm so no additional plugins are needed.

wilk_randall left a reply on Work Remotely With Laravel

artisan commands are console commands, so you need to run them through the terminal (shell)

wilk_randall left a reply on Work Remotely With Laravel

PHPStorm is a good tool to use. It allows for ftp, database access, and shell access all in the editor, plus it doesn't show passwords in the editor settings.

27 Dec
3 weeks ago

wilk_randall left a reply on Best Way To Use Wordpress With A Laravel App?

You could always just create your own blogging system using laravel itself. It wouldn't really be that complicated to do.

25 Dec
3 weeks ago

wilk_randall left a reply on I Can't Submit My Form

This is a prime example of what happens when all you do is have other people solve your problems for you. I'm all for asking questions and getting help when you're stuck on something, but it's kind of ridiculous asking all these basic questions day in and day out for years now when you would know this stuff or how to solve your problems if you actually debugged or researched every one in a while. I get that some people learn at different rates, but OP here doesn't ever seem to learn anything, just saying.

24 Dec
3 weeks ago

wilk_randall left a reply on Protecting API/Route Against Direct Access?

For one, you should always be using a csrf token unless the request is not originating from your domain.

To not allow direct access to the urls, you could make a middleware that checks if the request is ajax, and if not, don't let the request through.

Something like this would probably work:

class AjaxMiddleware
{
     public function handle($request, \Closure $next)
     {
          if ($request->expectsJson()) {
                 // this is an ajax request
                 return $next($request);
          }

          // here you can handle non-ajax requests
     }
}

Once you register the middleware in App\Http\Kernel in the $routeMiddleware property, you can use it on the routes you need it for, like this:

// the ->middleware('ajax') part works if you called it 'ajax' in the 'App\Http\Kernel' class
Route::get('api/words', '[email protected]')->middleware('ajax');
23 Dec
3 weeks ago

wilk_randall left a reply on Include

Try `@include('admin.navigation') instead. It seems you still have much to learn about Laravel and programming in general... Please read the docs on views to get a better understanding.. https://laravel.com/docs/5.7/views

wilk_randall left a reply on Laravel Socialite Save Avatar

Why save the image too? I don't really see the point in it as you already have a url to reference the existing avatar from the social provider. All you're doing at this point is just using up more storage space on the server.

22 Dec
3 weeks ago

wilk_randall left a reply on Root Folder

You can literally just copy and paste them into your public directory if you don't know build tools. Then they will be "published"

wilk_randall left a reply on Use Curly Brackets Insite Double Curly Brackets In Laravel Template

You don't need curly brackets for that. Just do it like this:

{{ $object->$property }}
21 Dec
4 weeks ago

wilk_randall left a reply on Incrementing A Column Other Than Primary Key

For one, I would move the code that generates the code for a new product into an observer on the product model, like this:

protected static function boot()
{
    parent::boot();

    static::creating(function ($product) {
           $product->code = static::withTrashed()->max('code') + 1;
    )};
}

Also, I don't really think the race issue is a big issue in most cases, and if you're really worried about it, you could use a database transaction. If the transaction fails, then you could handle the error in whatever way you need to.

wilk_randall left a reply on How To Check If A Record Belongs To A User?

Sure, you can make whatever methods you want on your models. I would do it on the post though.

class Post extends Model
{
    public function ownedBy($userId = null)
    {
         $userId = $userId ?: auth()->id();

         return $this->user_id === $userId;
    }
}

wilk_randall left a reply on How To Check If A Record Belongs To A User?

What did you do?

I would set the user_id on the post and then do something like $post->user_id === auth()->id()

20 Dec
4 weeks ago

wilk_randall left a reply on Add Up/Down Vote Instead Of Best Reply

@cronix I think it's 500xp for a best reply, not 1000 :)

wilk_randall left a reply on Experience Points In Laracasts

You can also gain experience by asking questions and replying to questions. The quickest way is to get best replies on questions.

19 Dec
4 weeks ago

wilk_randall left a reply on Add Up/Down Vote Instead Of Best Reply

Down voting doesn't have to be a negative thing. If a reply doesn't really add value or isn't even relevant to the thread, it should be down voted. This would help prevent people from wasting their time reading irrelevant replies like @shez1983 mentioned.

Also, @cmdobueno brings up a good point that experience really not indicative of the user because it is so easily gained through just watching videos or even just marking videos at watched. I've seen people on the leader boards who literally have no best replies and their experience is made up purely from watching videos/asking questions.

wilk_randall left a reply on Add Up/Down Vote Instead Of Best Reply

I agree that it could cause negativity, but at the same time I see it a useful tool like stated above to weed out some not so necessarily good answers. Other sites like stack overflow use up and downvotes and I don't see it brining a lot of negativity there.

Are there going to be people who abuse or always just downvote people? Sure, but you are always going to have those kinds of people, and you can't always protect people from getting their feelings hurt; this is the real world after all.

wilk_randall left a reply on Laravel Mix

@munazzil - Your reply has absolutely nothing to do with the question here.

@iki - webpack is unable to resolve those dependencies it has listed in the error. It seems the js scripts you are combining are referencing other scripts that are not installed. Are you sure you have those dependencies installed?

18 Dec
1 month ago

wilk_randall left a reply on Not Seeding Test Database

Try using the Illuminate\Foundation\Testing\RefreshDatabase instead, and also I recommend storing test settings in your phpunit.xml file instead of another .env file.

You can still use mysql if you want, but I've found it sometimes better to use an in memory sqlite database instead. But again, that's ultimately up to you.

In your phpunit.xml file, you would just need to add the following to the php element:

<env name="DB_CONNECTION" value="sqlite" />
<env name="DB_DATABASE" value=":memory" / >

wilk_randall left a reply on Vue Js Page View Source Not Readable

There's not really a need to change anything here as google will be able to crawl your pages just fine like that. Google will be able to render your javascript like that. The only problem you will have with seo is if you're using ajax to fetch data, but it doesn't look like that's the case.

In my experience, seo people are just a pain to work with as they don't seem to understand that it's just fine to render pages like this. You can explain it to them until you're blue in the face but they never seem to listen.

17 Dec
1 month ago
14 Dec
1 month ago

wilk_randall left a reply on Invalid Argument Supplied For Foreach()

@munazzil That doesn't do anything; you're overwriting $result on the next line.

13 Dec
1 month ago

wilk_randall left a reply on Invalid Argument Supplied For Foreach()

Your error is you are trying to foreach around something that is not iterable. I don't really use mysqli_query at all, so I'm not sure what it returns, but obviously you can't iterate over it.

You should try to debug your script, it might help. I would start by dumping your $result variable to see what you actually have:

var_dump($result);

I searched on google, and you may need something like this:

while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
    print_r($row);
}

Example taken from: https://stackoverflow.com/questions/24470605/mysqli-query-foreach-works-differently-in-local-and-server

wilk_randall left a reply on Set Data In VUE Dinamic

Did you try that? It should work

12 Dec
1 month ago

wilk_randall left a reply on When I'm Trying To Update Image It's Works Properly But Old Image Doesn't Delete.

@jlrdw File::delete() is pretty much just a wrapper for unlink.

@shamsul_huda What happens if you do this?

dd(File::exists($filename));

wilk_randall left a reply on Controller Route Subfolder

No you have to use it in every one, but it's really not a big deal.

wilk_randall left a reply on 45 Useful JavaScript Tips

@isabellathackeray You're missing the point. It's not about not being interested in your article, it's about people like you spamming the forum with their unsolicited advice when the forum is actually for questions, not stuff like this. Would this not be better suited for your own site?

11 Dec
1 month ago

wilk_randall left a reply on How To Remove Questions In Laracast?

@wwweston it kind of makes sense though that it's like that...

@moses - instead you can mark it as solved so that it may help others who might have the same question

wilk_randall left a reply on Best Way To Dynamically Edit A Model

Send only the data you need with each request, and then just fill the model:

$quote->update($request->all());

You could also separate it into different functions and do something like this:

public function updateBilling(Request $request, Order $quote)
{
    $order->update($request->only([
         'billing_address_1', 'billing_address_2', 'billing_city', 'billing_country', 'billing_state', 'billing_phone'
    ]);

    // or do this, up to you
    $order->update($request->all());
}

wilk_randall left a reply on How To Make Image File From An External Url?

Why not just make a separate function to save an image from a url?

wilk_randall left a reply on How To Make Image File From An External Url?

Why put it in $_FILES? That's just an unecessary step really. All you have to do is something like this:

$imageContents = file_get_contents($url);

Storage::put('your/file/path/image_name.jpg', $imageContents);

This is a very simplified snippet, but it's basically what you need to do. Most important part is file_get_contents().

wilk_randall left a reply on How To Create A Class That Will Return An Array Or Single Item?

Relax, your question hasn't even been up here for very long. If someone has an answer they'll provide it. Most people answer questions during their own free time and aren't just sitting here waiting for your questions.

wilk_randall left a reply on Data Type For All Numbers. Ex: 2, 3.3, -2.890, 01, Etc

@jpeterson579 you can do comparisons on strings like that, but you're better off casting them first to a numeric data type and then comparing them.

wilk_randall left a reply on What Is The Flow That You're Following When Developing API Application?

It doesn't really take much longer to do those kinds of tasks either when you use libraries like axios to reduce the amount of code you need to write. You just need to find a good work flow to get into and you won't find it to be much extra work at all. On a project I'm working on, I have mixins I have made for vue that further help with ajax requests and forms by helping me normalize certain aspects of the request and making it so I don't have to repeat myself very much.

What about CRUD is time consuming? You really don't have to write much code in laravel to save/update/delete items, especially when you are using features like route model binding and form requests to validate your data.

wilk_randall left a reply on What Is The Flow That You're Following When Developing API Application?

Actually for me form validation is less work if you set things up right. A vue validation package like Vee Validate helps with that.

06 Dec
1 month ago

wilk_randall left a reply on So, How Exactly Do You Get JQuery From Webpack To Work With Blade?

@munazzil I think you misunderstand. @gthell wants to use webpack and not include jQuery/bootstrap scripts like that