joshuajazleung

joshuajazleung

Member Since 9 Months Ago

Experience Points 34,480
Experience
Level
Lessons Completed 341
Lessons
Completed
Best Reply Awards 0
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.

24 Sep
1 month ago

joshuajazleung started a new conversation Having Difficult Understanding This Video

I was watching this video https://laracasts.com/series/eloquent-techniques/episodes/4 There is one particular thing I don't grasp.

this method apply() accepts a builder instance, but what is passed (the LessonFilters) to the method is not a builder instance.

abstract class QueryFilters
{
  public function apply(Builder $builder)
    {

  }
}
trait Filterable
{
   public function scopeFilter($query, QueryFilters $filters)
    {
        return $filters->apply($query);
    }

}
class LessonsController extends Controller
{
    /**
     * Show all lessons.
     *
     * @param  LessonFilters $filters
     * @return Collection
     */
    public function index(LessonFilters $filters)
    {
        return Lesson::filter($filters)->get();
    }
}

Am I missing something? LessonFilters is not a builder, How is apply() accepting LessonFilters as a parameter?

21 Sep
1 month ago

joshuajazleung started a new conversation Do You Create A Test For Each Validation Rule Of Each Fields?

I was watching this video https://laracasts.com/series/phpunit-testing-in-laravel/episodes/17?autoplay=true And jeffrey creates single test for each validation rule.

I am wondering if that's the standard way of testing validation rules? Say I have 10 fields and each field has 3 validation rules, that's 30 tests....

Would it be better if I create a test for each field? So only 10 tests in total?

14 Sep
1 month ago

joshuajazleung left a reply on Cannot Access Homestead Minio Control Panel

It turns out I have to add "homestead" to /etc/hosts file.

It is now working fine.

joshuajazleung started a new conversation Cannot Access Homestead Minio Control Panel

I followed the instructions here https://laravel.com/docs/5.7/homestead#configuring-minio. And ran the commands vagrant destroy vagrant up

I am supposed to be able to access http://homestead:9600/, but I cannot. Run into ERR_NAME_NOT_RESOLVED

WHY?

09 Sep
2 months ago

joshuajazleung started a new conversation How Do You Testing Laravel Filesystem With AWS?

Is there any resource on testing Laravel with AWS? Any guideline/rule of thumb on this?

03 Sep
2 months ago

joshuajazleung started a new conversation How To Model Thumbnails?

Say I have a Video model. A video has one main thumbnail, and many other thumbnails. What's the suggested way to model thumbnails? Should I create the following model classes?

  • Video
  • MainThumb
  • SideThumb

or just

  • Video
  • Thumb and the Thumb model has an attribute to indicate whether it's a main thumb?
28 Aug
2 months ago

joshuajazleung started a new conversation How Do You Logically Group Tests For A Resource?

For example, if I want to test that admin can CRUD a post, is it better to put all these test under the same file or to split the tests into multiple classes: EditPostsTest.php, CreatePostsTest..... and so on?

And what's the convention for naming the class(es)?

12 Aug
3 months ago

joshuajazleung started a new conversation How To Deal With Dependency Injection With Dynamic Parameters In The Constructor?

Let's say I have a class that requires some parameters in the constructor:

class SomeClass {
   public function __constructor(AnotherClass $cls) {...}
}

I want to inject this class into a method of other class with dependency injection, but $cls is dynamic (meaning I have no idea what will be passed to):

public function someMethod() {
   foreach($images as $image) {
     $inst = new SomeClass($image)
   }
}

Should I create a method to receive the parameter instead?

class SomeClass {
   public function __constructor() {...}
   public function getImage(AnotherClass $cls) {....}
}

and call like this?

public function someMethod(SomeClass $sc) {
   foreach($images as $image) {
     $inst = $sc->getImage($image);
   }
}

What is the standard way of doing things like this?