freekmurze

freekmurze

Developer at Spatie

Member Since 5 Years Ago

Antwerp

Experience Points
46,170
Total
Experience

3,830 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
776
Lessons
Completed
Best Reply Awards
7
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 10
46,170 XP
09 Feb
1 year ago

freekmurze left a reply on How To Route Notifications Based On The Notification Being Sent

For those visiting this thread, you'll be happy to learn that in Laravel 5.6 the notification is passed to the route method.

02 Dec
1 year ago

freekmurze left a reply on How To Route Notifications Based On The Notification Being Sent

I wound up getting the notification via the arguments of the calling function.

(warning: this solution is not for the faint of heart)

public function routeNotificationForSlack()
{
    $notification = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 3)[2]['args'][1]; 

    if ($notification instanceof MySpecialSnowflakeNotification) {
        return $this->alternative_slack_webhook;
    }
    return $this->slack_webhook;
}

It's a bit fragile, but it works. I've submitted a PR to have the notification passed down to routeNotificationForXXX in a clean way.

freekmurze left a reply on How To Route Notifications Based On The Notification Being Sent

Technically that could work, but unfortunately there are quite some alternative webhooks.

Thanks for the idea though.

freekmurze started a new conversation How To Route Notifications Based On The Notification Being Sent

Sending notifications to a single webhook is quite easy. Just add a function the notifiable. The docs contain this example:

public function routeNotificationForSlack()
{
    return $this->slack_webhook_url;
}

This is good if all notifications should be send via the same slack webhook. But image some notifications should be send to another webhook on the notifiable. I'd like to be able to do this:

public function routeNotificationForSlack($notification)
{
    if ($notification instanceof MySpecialSnowflakeNotification) {
        return $this->alternative_slack_webhook;
    }
    return $this->slack_webhook;
}

Unfortunately the notification isn't being passed to routeNotificationForSlack atm.

What is the easiest way to achieve that behaviour?

14 Jun
2 years ago

freekmurze left a reply on Pagination Using JSON API Strategy.

I've packaged up this code (and gave you some credit)

https://github.com/spatie/laravel-json-api-paginate

freekmurze left a reply on Pagination Using JSON API Strategy.

Turns out Illuminate\Database\Eloquent\Builder is Macroable

So you can do this in a service provider:

Builder::macro('jsonPaginate', function($maxResults = 30) {
    $size = request()->input('page.size', $maxResults);
    if ($size > $maxResults) {
        $size = $maxResults;
    }

    $paginator = $this->paginate($size, ['*'], 'page.number');

    $paginator->setPageName('page[number]');

    $paginator->appends(array_except(request()->input(), 'page.number'));

    return $paginator;
});

and use on all models.

Model::jsonPaginate()
13 Jun
2 years ago

freekmurze left a reply on Pagination Using JSON API Strategy.

Hi, on which object should this trait be applied?

24 Nov
2 years ago

freekmurze left a reply on Error When Upgrading To Laravel 5.3

Did you remove the compiled file?

22 Nov
2 years ago

freekmurze left a reply on Monitor Site Availability

Hi, I made a Laravel package the can monitor both uptime and ssl certificates. It can send out notifications to Slack (or any other notification provider you prefer) when something goes wrong.

Read all about it here: https://murze.be/2016/11/an-uptime-and-ssl-certificate-monitor-written-in-php/

26 Jun
3 years ago

freekmurze left a reply on Laravel 5.3 Wish List

I'd like to have Adam's pipe macro as a regular function on the collection class. https://github.com/laravel/framework/pull/13899

freekmurze left a reply on Laravel 5.3 Wish List

@xsmall I've made some packages that you might find useful:

All three packages have extensive docs, so you should have no problem using them. If you have a question about them, feel free to submit an issue at GitHub.

21 Jun
3 years ago

freekmurze left a reply on Laravel And Fractal

I've written an easy to use package to integrate Fractal into Laravel/Lumen: https://github.com/spatie/laravel-fractal

09 Jun
3 years ago

freekmurze left a reply on Metrics Dashboard Using Vue And Laravel?

Here's my take on implementing a dashboard with Laravel and Vue: https://murze.be/2016/06/building-dashboard-using-laravel-vue/

freekmurze left a reply on Uploading Files On S3 As Private File And Then Accessing The File

The medialibrary package can upload files to S3 and generate URL's to them: https://docs.spatie.be/laravel-medialibrary/v4/introduction

freekmurze left a reply on Dashboards And Statistics

I've recently created a dashboard that uses Larave, Vue, Pusher and graph.js. Read all about it here: https://murze.be/2016/06/building-dashboard-using-laravel-vue/

02 Mar
3 years ago

freekmurze left a reply on Mailchimp SSL Certificate Problem

@bashy thanks, will try that on the next droplet that is giving me troubles

01 Mar
3 years ago

freekmurze left a reply on ZipArchive Not Found In PHP 7 Forge Servers

I think it's a very new problem. ZipArchive is only missing from server I've set up in the last couple of days.

To install it just run this command:

sudo apt-get install php7.0-zip

@bobbybouwmann and it's indeed necessary for the backup package :-) New major version will be released somewhere this week.

freekmurze started a new conversation ZipArchive Not Found In PHP 7 Forge Servers

Newly provisioned Forge server do not seem to have ZipArchive installed.

new ZipArchive(); //results in class not found error.

Anybody have clear instruction on how to install this?

freekmurze left a reply on Mailchimp SSL Certificate Problem

I encountered this problem as well. Just rebooting the droplet solved it. Pretty sure there must be a more elegant way of handling this.

04 Feb
3 years ago

freekmurze started a new conversation Always Backup Your Servers

Yesterday one of my servers at DigitalOcean simply ceased to exists. If I had not made backups all the data of a client would be lost. Read the full story here: https://murze.be/2016/02/today-digitalocean-lost-our-entire-server.

If you are using one of those fancy cloud hosting providers like DigitalOcean, Linode or AWS as well make sure that you have backups of all your files and all your client files.

Forewarned is fore armed!

03 Feb
3 years ago

freekmurze left a reply on Laravel 5 Route For Robots.txt

My company made a package that solves this problem.

https://github.com/spatie/laravel-robots-middleware

Instead of you having to create a robots.txt this package will add a x-robots-tag to every request. You can extend the middleware to add custom logic that determines if the tag should be added and what the contents of the tag should be.

13 Jan
3 years ago

freekmurze left a reply on Laravel Full Page Caching

Try removing:

$response = $next($request);

And replacing

return $response;

by

return $next($request);
08 Dec
3 years ago

freekmurze started a new conversation How To Install The Imagick Extension For PHP7

Hi,

I provisioned a server with PHP 7 using Forge. I want to use imagick. What is the correct way to install the imagick php extension?

24 Nov
3 years ago

freekmurze left a reply on Obfuscate Download URLs?

You might be interested to know that the medialibrary package gained support for custom directories

06 Oct
3 years ago

freekmurze started a new conversation Code Review: A Fractal Service Provider For Laravel

Hi,

I put some work in an easy to use Fractal integration today. I'm welcoming all feedback before I tag version 1.0.0. tomorrow.

https://github.com/spatie/laravel-fractal

freekmurze left a reply on Fractal And Auth Server Tutorials

If you're looking for an easy integration of Fractal with Laravel, I'm currently working on it

28 Sep
3 years ago

freekmurze left a reply on ACL Middleware

I've created a middleware to check authorization on the route-level and released it as package. Take a look: https://github.com/spatie/laravel-authorize

24 Sep
3 years ago
11 Sep
4 years ago

freekmurze left a reply on HTTPS Health Check URL

You've already figured it out while I was typing. Nice!! :-)

freekmurze left a reply on HTTPS Health Check URL

Some browsers, like Chrome and Safari, fetch the certificate chain themselves if it is incomplete. Others, notably Firefox and a few mobile browsers do not. So if you're using Chrome you probably won't see the issue that users of other browsers (and command line tools) are having.

Normally Comodo should have sent you the intermediate certificates as well. You'll need to manually concatenate those after your domain specific certificate. It's a bit tedious error prone.

Alternatively you could just paste your domain specific certificate into https://certificatechain.io It will return your certificate concatenated with all intermediates. This is much easier than doing it manually.

If you've already installed a certificate for your domain Forge with tell you the file where the certificate is installed. It should look something like /etc/nginx/ssl/<your domain name>/<random number>/server.crt Just paste paste the whole chain (= specific certificate + intermediates) into that file and you're golden :-)

freekmurze left a reply on HTTPS Health Check URL

Maybe there's something wrong with the certificate. Have you checked with a tool like https://www.ssllabs.com/ssltest/ if everything is ok?

Did you install the intermediate certificates as well? If not, you may find https://certificatechain.io/ helpful.

10 Sep
4 years ago

freekmurze left a reply on Anyone Know Of Any Issues With OS X El Capitan GM?

I installed the GM this morning on both my MacBook pro (2015) and iMac (2011). Zero issues. Homestead / Vagrant is running fine. Npm just works. All apps are regulary use (phpstorm / sequel pro/ slack / iTerm 2) are just working

Obligatory disclaimer: Your mileage may vary.

09 Sep
4 years ago

freekmurze left a reply on SFTP Upload

You could create an sftp disk. Look in the Filesystem / Cloud storage documentation for more info.

07 Sep
4 years ago

freekmurze left a reply on Laracast - Bulk File Uploads - Syntax Question

After years of PHP programming, until shortly, I didn't know that syntax. I wrote a little post about it on my blog. ES6 can now do this as well.

02 Sep
4 years ago

freekmurze left a reply on Image Upload Using Storage Function To Public Folder

I've made a package called medialibrary that fits your use case.

Once installed you can do this:

$yourModel->addMedia($yourUploadedFile)-> toMediaLibraryOnDisk('images','s3')

Retrieving the url to a file that's stored in the library is easy as well:

$yourModel->getFirstMediaUrl('images', 'thumb') //returns an url that points to your file on S3

The package uses streams to upload to S3, so upload big files aren't a problem. Of course there's support for using the local filesystem as well. The package also can create thumbnails of your images. The generation of such thumbnails can be queued.

Take a look at the documentation to learn what's possible.

06 Aug
4 years ago

freekmurze left a reply on Isolate Sites

You could also opt to just provision two Forge servers. There's no better isolation than that. But of course you'll also double the hosting bill.

freekmurze left a reply on Require File

If you want to require certain files explicitly on every request then you can use Composer's 'files' autoloading mechanism: https://getcomposer.org/doc/04-schema.md#files

freekmurze left a reply on Package Development

This is a blog article on how Prosper Otemuyiwa starts developing packages (cached version, his site seems to be down atm)

And you can read on my blog how I do start working on package myself.

05 Aug
4 years ago

freekmurze left a reply on Upload Image

I have made a package that does all the hard work for you. Once installed you can do this:

$post->addMedia($request->file('image'))->toCollection('images');

You can display the image in your blade view with:

<img src="{{ $news->getFirstMediaUrl('images') }}">

If you want a thumbnail of that image:

<img src="{{ $news->getFirstMediaUrl('images', 'thumb') }}">

The full documentation: https://github.com/spatie/laravel-medialibrary

04 Aug
4 years ago

freekmurze left a reply on [SUGGESTION] Handling Images In Tables?

Take a look at my medialibrary package. It can associate images with Eloquent models and create images of different sizes: https://github.com/spatie/laravel-medialibrary

freekmurze left a reply on Image Handling And Display

I made a package that just might fit your requirements: https://github.com/spatie/laravel-medialibrary Check it out!

29 Jul
4 years ago

freekmurze left a reply on Check If A Variable Exists

you're probably looking for the isset function

26 Jul
4 years ago

freekmurze left a reply on Package For Managing Images

Take a look at laravel-medialibrary. It can relate files with Eloquent models and generate derived versions of images/pdfs.