RayRutjes

RayRutjes

Member Since 4 Years Ago

Experience Points 17,610
Experience Level 4

2,390 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 178
Lessons
Completed
Best Reply Awards 11
Best Reply
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.

19 Feb
1 year ago

RayRutjes left a reply on Request For Feedback On Vue InstantSearch By Algolia

Thank you for the kind words,

Could you be more explicit about the SSR issues you are encountering?

Best,

23 Aug
1 year ago

RayRutjes started a new conversation Request For Feedback On Vue InstantSearch By Algolia

Hello!

I just officially released the Vue InstantSearch library that helps you build search experiences in your frontend https://github.com/algolia/vue-instantsearch

The idea is to use Laravel Scout to index your data, and use Vue InstantSearch to power the search experience in the frontend.

Jeff covers this in 2 videos:

We would love to have your feedback on it!

02 Jul
3 years ago

RayRutjes left a reply on Event Sourcing Library, Looking For A Contributor To Set Up A Lumen Example

I sure have checked out the governor framework, which claims itself as the AxonFramework portage to php.

The owner of the framework is very kind, and he has done a great job so far.

I myself have learned a lot studying the axon framework.

Axon framework being written in java, the process of porting it to php isn't simple, because a lot of complexities are introduced by the fact that java is multithreaded, and also has some nice features like nested classes (sure there is a better name for those.)

Our way of thinking is a bit different than simply trying to port the axon framework. We want to create a framework, inspired from all the other work available on the subject, and implement it step by step so we understand the real complexities behind all the concepts, and try to solve them with the tools we have in php in an elegant way.

Once again, as of today, our work has far less features to offer as broadway or governor, or axon framework and all the others others that are worth inspiring from. That said, we believe there is room for another implementation, like taylor thought there was room for laravel.

RayRutjes left a reply on Event Sourcing Library, Looking For A Contributor To Set Up A Lumen Example

I think Broadway is a great package. However we would like to take the concepts a step further.

As of today, Broadway as more to offer than our domain foundation lib.

Our goal is to build a little framework that really eases the process of setting up projects that rely on an event sourced domain layer.

We would then love to make some bridges to most used frameworks so that it plays nicely with them also.

Finally, Broadway being the only lib having some reputation when it comes to event sourcing, we think it is worth offering a different implementation, so that we can benefit from one another.

The theory behind EventSourcing is quite simple to understand, and a lot of people wrote some great posts explaining the basics of it. The problem arises when you try to actually implement it, and face all the complexities involved, when you try to respect DDD principles. We also take this library as an occasion to discuss all the tricky points.

Finally, we do count on the community to prove, that in the end, php can also support complex projects.

01 Jul
3 years ago

RayRutjes started a new conversation Event Sourcing Library, Looking For A Contributor To Set Up A Lumen Example

Hi there,

We are actually developing an eventsourcing library : https://github.com/RayRutjes/domain-foundation

We have an example of implementation here : https://github.com/RayRutjes/domain-foundation-example-silly

I would love to see a simple lumen example, if anyone masters the subject.

Some general feedback is also appreciated.

12 May
3 years ago

RayRutjes left a reply on Looking For Some DDD Contributors

By the way, the code is released under MIT License.

RayRutjes started a new conversation Looking For Some DDD Contributors

Hi all of you,

I have started a little package which is composed of a set of interfaces and abstract objects allowing to speed up your domain driven designed (DDD) projects.

The package also holds a bunch of Value Objects that I want to enrich.

I am actually looking for some contributors to take this package to the next level, which would be a stable version 1.0.0.

Any pull request is welcome, just some conventions here:

  • The code follows PSR2 standards
  • The code shall respect the SOLID principles
  • Code should be 100% tested with phpspec
  • The delivered solutions should as much as possible try to respect the DDD principles, as defined in the Eric Evans book, and other ddd evangelist around the web

If you have any suggestion on how to improve this package, drop an issue.

What you could do:

  • Check if the actual implementation makes sens to you regarding ddd principles
  • Check if SOLID principles are respected
  • Add some Value Objects, or add some behaviour to existing ones
  • Add some DDD stuff (cqrs? command bus? Event sourcing?)
  • Or simply give your opinion

https://github.com/RayRutjes/domain

08 May
3 years ago

RayRutjes left a reply on Flysystem S3

This clearly states that the region the request was sent to is not correct.

RayRutjes left a reply on Flysystem S3

By the way the url is wrong: .amazonaws.com.amazonaws.com ? .amazonaws.com Should be mentioned once

RayRutjes left a reply on Flysystem S3

Still referencing eu-west-1 ???

RayRutjes left a reply on Flysystem S3

The curl message states that it can not reach the host: Could not resolve host So maybe your working in an environment that does not allow you to access aws server?

RayRutjes left a reply on Flysystem S3

I am running out of ideas here, have you published the configuration files of the backup package?

RayRutjes left a reply on Illuminate/Cache Standalone

Why don't you simply grab the cache from the container and configure it in your config file?

RayRutjes left a reply on Flysystem S3

Forget about configuration and totally forget about the bad practise of modifying stuff in vendor... Have you checked that the credentials you put in your configuration have access to the bucket in read & write?

You can check the permissions in the top right of your bucket. You could give everyone access in read & write for a few minutes to see if that is the problem.

RayRutjes left a reply on How To Add Dynamic Parameter To Routes

Take a look at this repo, everything you need is in there I think: https://github.com/mcamara/laravel-localization

RayRutjes left a reply on Need To Get Only Top Parent Item When Any Sub Level Of Children Has A Relation Value

You have to establish your eloquent relations following: http://laravel.com/docs/5.0/eloquent#relationships

Then you simply fetch what you need from there I guess.

RayRutjes left a reply on How To Add Dynamic Parameter To Routes

You could create a middleware intercepting the first route parameter, and create a route group around all your routes by prefixing with a locale parameter.

RayRutjes left a reply on Flysystem S3

You switched your region to eu-west-2 right?

RayRutjes left a reply on How To Add Dynamic Parameter To Routes

In your controller action,

public function about($param2)
{
}

The parameter is automatically injected, is that what you need?

RayRutjes left a reply on Need To Get Only Top Parent Item When Any Sub Level Of Children Has A Relation Value

Hum, honestly, the way you presented the data is not very clear, could you simply show use your Eloquent entities, and tell us what you want to query from there?

RayRutjes left a reply on Setup A Multisite Environnement With Laravel 5

Don't try to achieve it the way you present it. Consider each website as a separated project and deploy a fresh copy of laravel. Environment variables are designed to basically add or remove stuff in production/development/test contexts of your project. If you find yourself implementing re-usable behaviours, extract a package and include it into each project. Much cleaner.

RayRutjes left a reply on Flysystem S3

Can you show us your actual implementation that triggers the S3 disk? By the way, I doubt you own the 'backups' bucket, have you created that one in your account? Because buckets must have a unique name across the whole aws platform.

RayRutjes left a reply on Should Repositories Handle The Create, Update And Delete?

The UserRepository should be focused on dealing with User entities. The PostRepository should be focused on dealing with Post entities.

$userRepository->addPost($user, $request->all());

The above snippet is wrong because: Repositories are part of the Domain of your application, and should only accept domain Objects. The Domain is the place where your business logic is implemented. Your entities are part of the domain, and your repositories also (at least the interface is, but let's not confuse ourselves here).

Your repositories should only be used for persisting and retrieving domain objects. That is the repository's responsibility The method names you use should reflect that responsibility, like:

findUserById(UserId $id); // This is the only time we need to reference the id, we should not deal with id's in the other methods, prefer using the nice User domain object
public function storeUser(User $user);
public function updateUser(User $user); // no raw data, we pass the entity, the repository just stores it
public function deleteUser(User $user); // do not implement deleteUserById

If you want to get on track, start by getting rid of your Repositories abstract classes and interfaces. Just create a basic simple and clean UserRepository for example. Implement only strictly the bear minimum you need for your application. ex: You don't need the updateUser method? Why the hell would you spend time implementing it?

Then, force yourself to only use the Eloquent query builder from within your repository. That's the place where it belongs.

Here is a little example to get you on track:

// controller
public function createPost($userId, PostService $postService, Request $request)
{
    try {
        $postService->createPost($userId, $request->all());
    } catch (DomainException $e)
    {
        // Redirect back with a nice error message
    }
    // Redirect with a success message
}

// Your application service
class PostService {
    /**
     * @var UserRepository
     */
    private $userRepository;
    /**
     * @var PostRepository
     */
    private $postRepository;

    /**
     * @param UserRepository $userRepository
     * @param PostRepository $postRepository
     */
    public function __construct(UserRepository $userRepository, PostRepository $postRepository) {

        $this->userRepository = $userRepository;
        $this->postRepository = $postRepository;
    }
    
    public function createPost($userId, $postData)
    {
        $user = $this->findUserById($userId);
        
        $post = Post::create($user, $postData['content']);
        $this->postRepository->storePost($post);
        
        // Dispatch some domain events: newPostWasCreated
    }
    
    private function findUserById($userId)
    {
        $user = $this->userRepository->findUserById();
        if(null === $user)
        {
            throw new \Exception('User not found');
        }
        return $user;
    }

I recommend you take a look also at:

  • FormRequest: to validate your data
  • Command/Handler: to clearly separate each action available in your application

Hope my answer helps you.

RayRutjes left a reply on What Would You Love To See In Laravel 5.1?

It looks like the community is looking for ways to structure the domain layer of their applications and Eloquent just doesn't fit well. I suggest a nice and clean Doctrine integration as an alternative or replacement of Eloquent.

RayRutjes left a reply on Should Repositories Handle The Create, Update And Delete?

You ARE gonna rebuild eloquent in a class called Repository which will have no added value. That will only add a layer of complexity to your application.

Your repository isn't supposed to chain anything. You ask it some data, and it returns the populated entities. That is a repository. What you are describing is a query builder.

Your repository methods could accept some criterias that can refine your queries. Take a look at how people use the specification pattern to implement nice and re-usable repositories.

By returning the Eloquent query builder from you'r repository, you are strongly coupling your repository to Eloquent, and that goes against the concept of the repository pattern.

06 May
3 years ago

RayRutjes left a reply on Should Repositories Handle The Create, Update And Delete?

Your repository should always return models/entities, not references to the query builder as in your actual usersOfGroup's implementation.

I don't know what you have put in your BaseRepository but to me it is probably wrong.

The idea behind repositories is also being able to switch the actual implementation. So I'd recommend you extract some nice little interfaces, with the minimum required for your application. Don't spend time implementing a magical BaseRepository class. You could create an abstracted repository for eloquent for exemple, like EloquentRepository, that would accept the model in its constructor and store it. But it shouldn't get any further.

class EloquentUserRepository extends EloquentRepository implements UserRepository {

   // getUserById($id);
   // storeUser(User $user);
   // deleteUser(User $user);

   public function usersOfGroup($group_id)
   {
       return $this->model->whereGroupId($group_id)->get();
   }
}

If you plan on putting methods like "save" etc in your BaseRepository, your are probably rebuilding Eloquent or building a proxy layer.

I think that when you use Eloquent, stick with it, don't try to decorate it with common patterns just because people say they're great. If you're business needs are complex and you wan't to really structure your code a bit more at the domain level, use the Laravel's database layer without Eloquent or integrate Doctrine 2 which natively support the repositories.

To finish, the way you intend to bind your business logic to Eloquent's eventing is not a good idea, as if something fails in a transaction, the events can not be rolled back.

Does this make sense to you?

Could you give us some overview of your actual mapping?

05 May
3 years ago

RayRutjes left a reply on Should Repositories Handle The Create, Update And Delete?

Don't fall in the trap of abstracting so much that you are rebuilding Eloquent. As @Penderis mentioned, use your repositories as a proxy to access your models in an expressive way.

RayRutjes left a reply on View Composer : Bind Composer To A Partial

Have you tried a dd() in your mainNavigation to see if it is actually parsed?

RayRutjes left a reply on View Composer : Bind Composer To A Partial

Did you setup your binding in a service provider? If yes have you thought about adding your service provider to the config/app.php file?

RayRutjes left a reply on [L5] Listing To Queues

you could add an environment and setting your required connection as the default one and running the artisan command in that environment?

RayRutjes left a reply on Github + Laravel Problems

Have you doublechecked your virtual host configuration? Document root pointing to the public folder? Your are accessing the correct url? Reloaded apache?

RayRutjes left a reply on Custom Laracasts.com Styles

I would love to switch the whole laracast to a darker version not ruining my eyes ^^

RayRutjes left a reply on Migrate For Multi Tenant Database

IMHO, when I start thinking of deploying a database automatically per tenant, it is (nearly) always a smell of a project that will never be deployed because of it's complexity.

Imagine the pain for changing your database schemes etc. So much work.

Before trying to resolve this kind of problem, ask yourself if you really need to complicate this as much.

Can you explain why you want to implement a per tenant database logic?

RayRutjes left a reply on Integration Testing

Try to dump the full stack trace of the raised exception if there is one?

RayRutjes left a reply on Should Repositories Handle The Create, Update And Delete?

Would you share some code so we can actually discuss the implementation?

RayRutjes left a reply on Github + Laravel Problems

yes, add it before "autoload" for example, and verify your repo name (I guessed it as: mk10shun/framework) and adjust it in the composer file to match it to github.

RayRutjes left a reply on [L5] Listing To Queues

You can simply pass your connection name as argument:

php artisan queue:listen connection

As stated here

php artisan queue:listen --help

RayRutjes left a reply on Problem With Prefix

Can your try to run this php artisan command?

php artisan route:list

This will show you all your routes, very handy for debugging

RayRutjes left a reply on Save Date

Use Carbon

$newAppointment = Appointment::create([
                'user_id' => $userId,
                'appointment_at' => Carbon::now()
            ]);

Don't forget to import Carbon.

Don't also forget to register your column as a date, so it is always returned as is in your model:

<?php
...
class MyModel extends Eloquent {
    protected $dates = ['appointment_at'];
}

RayRutjes left a reply on Github + Laravel Problems

If you have a hidden repo, you'll have to tell composer about it, otherwise there is no way for it to guess what you want:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/mk10shun/framework"
    }
]

Also run your composer update command with the --verbose argument to see what happens.

RayRutjes left a reply on Lumen Queue To L5

You should not consider that that Lumen and Laravel know each other. Those are 2 different frameworks and can potentially evolve in totally different ways.

The best way to decouple both is to to follow the following rule: you queue it, you run it

When you want to delegate a job to another instance/environment/microservice, create an api endpoint on that microservice that will accept the job and queue it.

That way, you will never have surprises regarding the execution of the jobs.

RayRutjes left a reply on Github + Laravel Problems

We need to see your composer.json file to see if you have correctly integrated vcs etc

RayRutjes left a reply on Mysql Database Replication & Failover Methods

Couldn't you simply start by automating the task of backing up your database daily, and store it in a secured bucket on S3 for example?

RayRutjes left a reply on Github + Laravel Problems

Could you provide us your composer file?

RayRutjes left a reply on Best PDF Generator?

+1 for wkhtmltopdf, it is definitely the best you can find