joshuajazleung

Experience

29,270

0 Best Reply Awards

  • Member Since 7 Months Ago
  • 290 Lessons Completed
  • 0 Favorites

14th September, 2018

joshuajazleung left a reply on Cannot Access Homestead Minio Control Panel • 5 days ago

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 • 5 days ago

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?

9th September, 2018

joshuajazleung started a new conversation How Do You Testing Laravel Filesystem With AWS? • 1 week ago

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

3rd September, 2018

joshuajazleung started a new conversation How To Model Thumbnails? • 2 weeks ago

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?

28th August, 2018

joshuajazleung started a new conversation How Do You Logically Group Tests For A Resource? • 3 weeks ago

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)?

12th August, 2018

joshuajazleung left a reply on How To Deal With Dependency Injection With Dynamic Parameters In The Constructor? • 1 month ago

@newbie360 I meant the parameter is passed within the foreach

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

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?

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.