jeroenherczeg

jeroenherczeg

Member Since 3 Years Ago

Hasselt

Experience Points 8,430
Experience Level 2

1,570 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 64
Lessons
Completed
Best Reply Awards 3
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.

13 Sep
2 years ago

jeroenherczeg left a reply on Laravel /passport And Postman Gets All The Time ⌚ Unauthorised

I don't know why but when I looked at the dd($request), the Authorization header was written "authorization--". It seems PAW adds invisible -- if it tries to do autocomplete.

12 Sep
2 years ago

jeroenherczeg left a reply on Laravel /passport And Postman Gets All The Time ⌚ Unauthorised

I can't get the passport grant working with PAW. Still get Unautherized

What I checked: - Went over the docs multiple times - Tried the expire date fix - Tried with Scope - Tried on Valet, Homestead and Forge/Digital Ocean - Added 'Bearer ' before the token

I looks like the Authorization header is being stripped, if dd($request), it still has the Accept header but not the Authorization header.

Anyone has more success?

Thanks in advance!

10 Sep
2 years ago

jeroenherczeg started a new conversation Laravel Passport

I am a bit confused on the laravel scopes part.

I have a user model and table.

How can I assign a user the role of user, customer and/or admin.

I have a SPA with vue and laravel api backend. I use https://laravel.com/docs/5.3/passport#consuming-your-api-with-javascript

        Passport::tokensCan([
            'user' => 'User',
            'customer' => 'Customer',
            'admin' => 'Admin',
        ]);

How can i assign which user model has which scope(s)?

Or are scopes not the same as roles?

How would you implement this?

Thanks in advance!

05 Aug
2 years ago

jeroenherczeg left a reply on Passport, Oath2, JWT And The Web Client

What I took away from it was, it implements the oauth server from the php league but using the package https://github.com/lucadegasperi/oauth2-server-laravel He showed the authorization code grant implementation https://oauth2.thephpleague.com/authorization-server/auth-code-grant/ but he also showed you can bypass this, I think with JWT tokens, so you can use your api for internal requests from the front-end.

Passport is only for authentication, you still have to implement endpoint, responses, error response structure, ... yourself.

I think passport makes sense if you have a saas app with external integrations, but I only have an api for my front-end. But I am still considering using it, so I have experience implementing it and have the know how for when I need it.

But I could be wrong :)

03 Aug
2 years ago

jeroenherczeg left a reply on Trying To Find A VueJS Teacher! Anyone Up For A 15min Session? - Japanese Lesson In Return!

@mesqueeb I am not an expert in Vue, but have some experience. I can maybe help you, Japanese lesson in return sounds great!

jeroenherczeg left a reply on 5.2, Scout, Passport Etc Released?

@theUnforgiven I am also waiting, this release is going to be great!

jeroenherczeg left a reply on 5.2, Scout, Passport Etc Released?

Laravel 5.3 will be released in a few weeks. It’s delayed for documentation. https://twitter.com/laravelnews/status/758392287659368448

jeroenherczeg started a new conversation Vue 2.0 - Webpack Simple 2.0

In the Laracon US video of Evan, he uses the webpack simple 2.0

vue init webpack-simple-2.0 my-project

But the image is not loading. I tried figuring out how webpack works but it I am at a loss, as well as others.

Could you have a look at: https://github.com/vuejs-templates/webpack-simple-2.0/issues/8

Thanks in advance!

Anyone else brave enough to use Vue 2.0 yet?

01 Aug
2 years ago

jeroenherczeg left a reply on Connection Timed Out - Session In Redis

This is the error trace I got.

Predis\Connection\ConnectionException Connection timed out [tcp://10.129.3.113:6379] 
    vendor/predis/predis/src/Connection/AbstractConnection.php:168 Predis\Connection\AbstractConnection::onConnectionError
    vendor/predis/predis/src/Connection/StreamConnection.php:97 Predis\Connection\StreamConnection::tcpStreamInitializer
    vendor/predis/predis/src/Connection/StreamConnection.php:58 Predis\Connection\StreamConnection::createResource
    vendor/predis/predis/src/Connection/AbstractConnection.php:94 Predis\Connection\AbstractConnection::connect
    vendor/predis/predis/src/Connection/StreamConnection.php:158 Predis\Connection\StreamConnection::connect
    vendor/predis/predis/src/Connection/AbstractConnection.php:193 Predis\Connection\AbstractConnection::getResource
    vendor/predis/predis/src/Connection/StreamConnection.php:184 Predis\Connection\StreamConnection::write
    vendor/predis/predis/src/Connection/StreamConnection.php:290 Predis\Connection\StreamConnection::writeRequest
    vendor/predis/predis/src/Connection/AbstractConnection.php:123 Predis\Connection\AbstractConnection::executeCommand
    vendor/predis/predis/src/Client.php:326 Predis\Client::executeCommand
    vendor/predis/predis/src/Client.php:310 Predis\Client::__call
    vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php:54 Predis\Client::get
    vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php:54 Illuminate\Cache\RedisStore::get
    vendor/laravel/framework/src/Illuminate/Cache/Repository.php:98 Illuminate\Cache\Repository::get
    vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php:58 Illuminate\Session\CacheBasedSessionHandler::read
    bootstrap/cache/compiled.php:11658 Illuminate\Session\Store::readFromHandler
    bootstrap/cache/compiled.php:11650 Illuminate\Session\Store::loadSession
    bootstrap/cache/compiled.php:11642 Illuminate\Session\Store::start
    bootstrap/cache/compiled.php:11552 Illuminate\Session\Middleware\StartSession::startSession
    bootstrap/cache/compiled.php:11532 Illuminate\Session\Middleware\StartSession::handle
    [internal] call_user_func_array
    bootstrap/cache/compiled.php:9592 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    bootstrap/cache/compiled.php:12678 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::handle
    [internal] call_user_func_array
    bootstrap/cache/compiled.php:9592 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    bootstrap/cache/compiled.php:12615 Illuminate\Cookie\Middleware\EncryptCookies::handle
    [internal] call_user_func_array
    bootstrap/cache/compiled.php:9592 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    bootstrap/cache/compiled.php:2982 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::handle
    [internal] call_user_func_array
    bootstrap/cache/compiled.php:9592 Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}
    [internal] call_user_func
    bootstrap/cache/compiled.php:9582 Illuminate\Pipeline\Pipeline::then
    bootstrap/cache/compiled.php:2254 Illuminate\Foundation\Http\Kernel::sendRequestThroughRouter
    bootstrap/cache/compiled.php:2237 Illuminate\Foundation\Http\Kernel::handle
    public/index.php:54 [main]

jeroenherczeg started a new conversation Connection Timed Out - Session In Redis

Hi,

I have a redis server running for queue but also for session management. I have one load balancer and 4 ningx servers. Everything is going great for half a year and now i regularly see this error pop up:

Connection timed out [tcp://10.129.3.113:6379]
releases/20160729085505/vendor/predis/predis/src/Connection/AbstractConnection.php on line 168 

The redis server has plenty of resources left (memory, cpu, ...) and there isn't that much traffic.

Anyone had a similar problem? Or does anyone know how to troubleshoot? I have new relic running and it doesn't look like there is too much traffic or work being done at the moments i get these messages.

Thanks in advance!

18 May
2 years ago

jeroenherczeg started a new conversation How To Gracefully Restart Supervisored Redis?

I use redis for import queue, my config looks like

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/forge/SITE/current/artisan queue:work --sleep=3 --tries=3 --daemon
autostart=true
autorestart=true
user=forge
numprocs=8
redirect_stderr=true
stdout_logfile=/home/forge/SITE/storage/logs/worker.log

After deploying with envoyer, the command still runs the old release.

If i just restart supervisor worker, it will stop the worker mid-import if I am unlucky.

Anyone has a good solution? Thanks!

25 Mar
2 years ago

jeroenherczeg left a reply on Homestead Php5-fpm Error

Yes update the vagrant box and update the homestead package and it works but homestead should be installed as a dev dependency

composer require laravel/homestead --dev
22 Mar
3 years ago

jeroenherczeg left a reply on Can't Validate MIME Type Of XLS File.

I have the same problem, i use form request

$rules['import_file_seeders_file'] = 'required|mimes:csv,xls,xlsx';

'import_file_seeders_file.mimes' => 'This file type is not allowed',

All files give me type not allowed.

I also tried this:

$rules['import_file_seeders_file'] = 'required|mimes:csv,xls,xlsx,text/csv,text/plain,application/csv,
            text/comma-separated-values,application/excel,application/vnd.ms-excel,application/vnd.msexcel,
            text/anytext,application/octet-stream,application/txt,
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
18 Mar
3 years ago

jeroenherczeg started a new conversation Universal Markup To Use For Slack And Email

I have to send the several notification message in my app to Slack and email the message.

This could be an error message, or a list of companies with license expirering alerts, some stats..

I thought I would compose the message in markdown and use this message to render for slack and for email (common/mark html renderer)

But I just figured out Slack doesn’t use markdown, it just looks a bit like it (it even has a option use enable markdown, but it doesn't parse normal markdown?).

What would be the best way to have a universal message build (by console command) and send it through slack and email?

jeroenherczeg left a reply on Ping Unknown Host Google.com

Problem is solved, Digital Ocean was experiencing problems.

https://status.digitalocean.com/

AMS DNS Connectivity
Our networking team is still investigating issues with Google DNS in our AMS regions. During this time we recommend changing your droplet to another DNS provider, such as OpenDNS. If you need assistance with this, feel free to open a support ticket. We will provide an update as soon as one is available.
17 Mar
3 years ago

jeroenherczeg left a reply on Ping Unknown Host Google.com

dig google.com

gives me

;; Truncated, retrying in TCP mode.

; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15920
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;google.com.            IN  A

;; ANSWER SECTION:
google.com.     299 IN  A   173.194.65.138
google.com.     299 IN  A   173.194.65.139
google.com.     299 IN  A   173.194.65.102
google.com.     299 IN  A   173.194.65.101
google.com.     299 IN  A   173.194.65.100
google.com.     299 IN  A   173.194.65.113

;; Query time: 7 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Mar 17 19:30:53 CET 2016
;; MSG SIZE  rcvd: 135

jeroenherczeg started a new conversation Ping Unknown Host Google.com

I have 4 servers setup with forge, on two i can ping google fine. But on the other two i get: unknown host google.com

both working and not working server look identical

/etc/resolve.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 8.8.4.4

pinging the ip works on all

Can someone point me in the right direction?

Thank you

03 Mar
3 years ago

jeroenherczeg left a reply on Redis With Laravel Series

+1 I like the topics suggested by OP

20 Feb
3 years ago

jeroenherczeg started a new conversation Factory Wants To Save Helper Variables In Db

If i run my db seeds, it wants to save my helper variable 'for' and 'type' in the db.

But I only need to save uri and md5.

Anybody know why this is happening?

$factory->define(Image::class, function (Faker $faker, Array $overrides) {

    $for   = isset($overrides['for'])  ? $overrides['for']  : 'users';
    $type  = isset($overrides['type']) ? $overrides['type'] : 'fashion';
    $image = $faker->image(public_path('storage/' . $for ), 600, 600, $type);

    return [
        'uri' => basename($image),
        'md5' => md5($image),
    ];
});
class Image extends Model
{
    protected $fillable = [
        'uri',
        'md5',
    ];
}
[Illuminate\Database\QueryException]
  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'for' in 'field list' (SQL: insert into `images` (`uri`,
   `md5`, `for`, `type`, `updated_at`, `created_at`) values (a000a76510a65a876dbf3f54129bb566.jpg, d99f4d8a061063
  69b31884df86605b6b, users, people, 2016-02-20 10:00:05, 2016-02-20 10:00:05))

jeroenherczeg left a reply on Constructor With Dependency Injection And Variables

Thank you @martinbean!

And is there a way, I don't have to do the Dependency Injections job?

This is a easy example, but say I want to inject Guard, it's not going to be funny.

19 Feb
3 years ago

jeroenherczeg started a new conversation Constructor With Dependency Injection And Variables

I hava a repository HitRepository

class HitRepository
{
    protected $model;

    public function __construct(Hit $model)
    {
        $this->model = $model;
    }
}```

And a service AnalyticsService

class AnalyticsService { protected $companyId; protected $startDate; protected $endDate; protected $hitRepository;

public function __construct(HitRepository $hitRepository, $companyId)
{
    $this->hitRepository = $hitRepository;
}

public function getTotal()
{
    ...
}

}```

How can I call in the controller:

    public function show($id)
    {
        $analyticsService = new AnalyticsService($id);
        $total = $analyticsService->getTotal();
    }

I get a Argument 1 passed to AnalyticsService::__construct() must be an instance of HitRepository, string given

21 Dec
3 years ago

jeroenherczeg left a reply on When I Get Some Traffic, Server Crashed 502 Gateway Timeout Nginx

I use the calculation on https://www.kinamo.be/en/kb/determining-the-correct-number-of-child-processes-for-php-fpm-on-nginx and these are my settings now, and are very stable.

pm.max_children = 25

pm.start_servers = 8

pm.min_spare_servers = 8

pm.max_spare_servers = 17

pm.max_requests = 500

jeroenherczeg started a new conversation Timezone Config

You can edit the timezone in laravel with config > app. You can edit the timezone in php with php.ini You can edit the system timezone with sudo dpkg-reconfigure tzdata

Is there a way to do this automatically with the vagant file for homestead and forge?

16 Dec
3 years ago

jeroenherczeg left a reply on Architecture Question, Best Approach For SSO With Multiple Apps And Some OAUTH

@isaackearl I have been given the same task as your question, did you already implement it? Would also love to get a push in the right direction.

15 Dec
3 years ago

jeroenherczeg left a reply on Package Development

+1 would also like to see some videos about package development for 5.1

24 Nov
3 years ago

jeroenherczeg left a reply on When I Get Some Traffic, Server Crashed 502 Gateway Timeout Nginx

I tweaked the php-fpm config using https://www.kinamo.be/en/kb/determining-the-correct-number-of-child-processes-for-php-fpm-on-nginx

I get better results, I use Jmeter to check what load i can handle know.

23 Nov
3 years ago

jeroenherczeg left a reply on When I Get Some Traffic, Server Crashed 502 Gateway Timeout Nginx

It is default forge install. Is set to pm.max_children = 5

I have a test server which i can test with jmeter, i put it on max_children 100 and know it goes perfect.

Why is the default setting not ok?

jeroenherczeg started a new conversation When I Get Some Traffic, Server Crashed 502 Gateway Timeout Nginx

So I have two site and a server, one lumen that makes api calls, one laravel for admin.

When I get some traffic, the server crashed 502 gateway timeout.

nginx log, says: 11:19:51 [crit] 880#0: *2 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 52.46.75.66, server: example.com, request: "GET /login HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "example.com"

php5-fpm.log says: 23-Nov-2015 11:06:08] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful (After reboot)

MySQL no problems

I have tried a lot but kind seem to find the problem.

17 Nov
3 years ago

jeroenherczeg left a reply on 500 Server Error

Yes, Laravel 5.1 uses features from PHP5.5 which aren't available in PHP5.4.

Either see if you can upgrade your version in cPanel, I have seen it available on some instances (somewhere under software/services > php configuration)

Else you have to use Laravel 5.0 or 4.2.

jeroenherczeg left a reply on 500 Server Error

Normally you should have some error logs, keep looking.

And normally you shouldn't have to specify /public folder in the url if you use the htaccess.

Please give more information so we can help you, linux distro, web server (nginx or apache), logs?, ...

jeroenherczeg left a reply on 500 Server Error

Check your .env file is correct on the server. Check your log files of laravel storage/logs/laravel<timestamp?>.log Check your log files of Nginx (/var/log/nginx/) or Apache (/var/log/apache2/)

Report back

jeroenherczeg left a reply on Run Database Seeders In Unit Tests

I made a specific DatabaseSeeder and use it in the test that I need

<?php

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

class TestingDatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();

        $this->call(SubscriptionTableSeeder::class);
        $this->call(AmvCountriesTableSeeder::class);
        $this->call(SocialNetworksTableSeeder::class);
        $this->call(RolesTableSeeder::class);

        Model::reguard();
    }
}
class CreateCompanyTest extends IntegrationTestCase
{
    use CommandHelperTrait;
    use DispatchesJobs;
    use DatabaseMigrations;

    public function testCreateCompany()
    {
        $this->seed('TestingDatabaseSeeder');
    ...