MikeLindsay

MikeLindsay

Web Developer at Freelance

Member Since 4 Years Ago

London

Experience Points
35,360
Total
Experience

4,640 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
347
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

Level 8
35,360 XP
Feb
28
4 months ago
Activity icon

Started a new Conversation Type Hinting And Method Injection In A Custom Class

Hi guys, just wrapping my head around the IOC container.

I want to inject a custom class into the method of another class. I don't want to put it in the constructor, I want to use it only in that method alone. I want to be able to bind it into the container in a service provider and not use any helper methods in my classes.

Can someone give me a steer on this??

EDIT - so I just discovered the app()->call('App\[email protected]'). Which works. Is there someway to put this or register this in a service provider so that I don't have to use the app() helper in my classes??

Thanks in advance

<?php

namespace App;

class Rabbit
{
    //The class to be injected
}

class Roger
{
    public function rabbit(Rabbit $rabbit)
    {
        //Have access to the Rabbit class here!
    }
}

Feb
13
4 months ago
Activity icon

Started a new Conversation Does This Code Break The LSP, As I'm Deferring To Another Method And Then Returning An Array?


interface UserRepository {
    /**
     * @return array
     */
    public function all();
}

interface FetchableWebService {
    /**
     * @return array
     */
    public function fetch();
}

class DatabaseUserRepository implements UserRepository {
    public function all()
    {
        return ['Data from local database'];
    }
}

class WebServiceUserRespository implements UserRepository, FetchableWebService {

    /* Am I breaking the Liskov Substitution principle by calling the fetch method
    even though it is returning an array type just like the DatabaseUserRepository?
    */
    public function all()
    {
        return $this->fetch();
    }

    public function fetch()
    {
        return ['Data From User stored on a 3rd Party that exposes an API'];
    }
}


Activity icon

Started a new Conversation If You're Using TDD And Your App Is Still In Development How Strict Should You Be About The Open/Closed Principle?

TLDR: - Can you be more lenient with the Open/Closed principle when building an undeployed project (with TDD) than if a working on a deployed app?

This is actually a bunch of questions:

  1. If you're working on a new undeployed project and you're using TDD and you need to add a new method to a class (e.g. even a simple extract method refactor) that implements an interface being used in your client code...can you add it if you have a good test suite and add it to the interface as well?

If you couldn't then it would mean that you get one shot to get a class with all the functionality that you needed and then you would have to Decorate the object. As the app is still being developed (let's say you were using Agile and requirements where changing) - it seems impractical?

  1. If your project was live (and for a few months) then should you resort to Decorating/Inheritance to extend the functionality and not touch the class at all as, in this case, bugs and breaking changes are serious.

Thanks in advance!