Laravel School has a good tutorial on how to apply the open closed principle in Laravel.

laravel principles