troovers

troovers

Member Since 1 Year Ago

Experience Points 450
Experience Level 1

4,550 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 0
Lessons
Completed
Best Reply Awards 0
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.

06 Sep
9 months ago

troovers left a reply on Authentication Inside Package

The Horizon option is indeed not as bad as I made it sound, but I need a little more influence on the users. To clarify: the package is going to be a simple CMS. When the user implements the auth callback, no users are required, they can just return true if necessary. But, when the package is going to be used for multiple customers, it's probably nice if the user can give other users access to the CMS for a specific account only. For that scenario, I perhaps also need to add users or give them the possibility to edit their profile.

I feel like none of the options above is "good enough". The callback method is perhaps too simple, but accessing projects tables feels hacky.

troovers started a new conversation Authentication Inside Package

I'm developing a package which is going to be quite large, and also requires authentication. The package contains "projects" which you can create. For those projects, you could give specific users access, so when they login, they see their projects.

I don't really want to rely on the general projects users table when people install my package. For instance, the columns might not have the specific names that I'm using in my project. So, I thought of adding a users table migration to my package, and requiring the project to use the package's User model class for authentication. However, I don't know if it's the nicest solution for the problem.

I could also make the user implement a callback which is used (like in Laravel Horizon) to determine whether a user should have access to a project, but then I would rely to much on the project for my package to work.

Do you have any tips on how to address this problem?

Regards,

Thomas

17 Jan
1 year ago

troovers started a new conversation Laravel Plugin For Website

Hey guys,

I've got a Manager for especially sports clubs. Within that manager, users can define activities, articles, polls et cetera that will be displayed in an app for members.

Currently, users are putting that information in the manager for the app and have to add the same info manually on their website. It's double the work.

What I'm seeking for, is a solution for this problem. So the user can create an article in the manager, that will be displayed in the app and on their website. My options could be a completely different website, that I would make, with API calls to my Manager, so that the information can be retrieved. Bu that would mean that for each club, I have to create a slightly different website. A lot of work.

The second option I thought of, is using iframes. But with iframes, you have to specify the height of the content, otherwise the page and iframe will be scrollable. They also won't display activities or articles in the clubs websites' style. Not my favorite option.

The last option I thought of, is enabling an API, giving the club that address and giving them the responsibility of making the calls and displaying the info. However, the amount of knowledge needed for this might be too much for a sports club.

None of the options above are 'great'. I'm seeking for a solution that doesn't give me a lot of work and makes it easy for the club to integrate the articles and activities on their website.

Do you guys have any tips? Thanks!

Greetings,

Thomas

24 Dec
1 year ago

troovers left a reply on How To: Let Users Know There Are New Features Available?

Silly that I didn't think of that. Thanks @martinbean.

21 Dec
1 year ago

troovers started a new conversation How To: Let Users Know There Are New Features Available?

Hi guys,

I've developed an application for multiple clients and am using Laravel Forge and Continues Integration to quickly deploy new features to the application. Some changes need to go unnoticed. However, I'm about to make a big change by implementing a new feature and would like to notify my clients about this. I've thought of a few ways, by sending an email for example. But, emails often get ignored. So I thought it would be nice if the user was shown the new features the moment he/she logs in for the first time after the deployment. Does anybody have some experience with this? What's the best and user-experience-friendly way to do this? Thanks!

20 Dec
1 year ago

troovers left a reply on Continues Integration Using Codeship And Laravel Dusk

Figured out how I could download those screenshots, am not sure why it didn't work the first time, but it did now. Turns out the tests we're failing because of wrong environment settings. Nothing I couldn't fix fortunately. Codeship is now working well with Laravel Forge!

05 Dec
1 year ago

troovers left a reply on Continues Integration Using Codeship And Laravel Dusk

Hi Haganjones, thanks for your answer. Dusk does indeed capture screenshots. Codeship provides the ability to debug. You receive an IP, which you can access using SSH. I'm however not able to download those screenshots to my MacBook. Perhaps you know how I can download those screenshots?

Setting up MySQL should not be the problem, it's working on my Homestead environment. Besides, my application identifies a customer by subdomain and then reconnects to the specific database. I'm not keen on rewriting code, to select a default database, just for testing purposes. First, I'd like to try to find a solution for the problem.

04 Dec
1 year ago

troovers started a new conversation Continues Integration Using Codeship And Laravel Dusk

Hi guys,

I started using Laravel Dusk to run browser tests for my project. I've written a few tests and made them all succeed on my local Homestead environment. Then I thought it was a good time to start testing if the integration with Codeship works. It doesn't unfortunately.

I've used the script that Laravel provided in the documentation and added a few other commands. My application is multi-tenant and connects to the customers' database by retrieving the subdomain of the url and searching for the customers' info. This information is being searched for in the general database, therefore I'm importing that database in the Codeship testing environment. Long story short, I've got no idea what the problem is, but all of my tests are failing. Maybe somebody knows what's going wrong?

Deployment script in Codeship

phpenv local 7.1
cp .env.testing .env
#Setup MySQL
mysql -e "CREATE DATABASE general;"
mysql general < ./database/sql/general.sql
mysql -e "CREATE DATABASE tenant_test_database;"
mysql -e "CREATE USER 'codeship'@'localhost' IDENTIFIED BY 'secretPassword';"
mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'codeship'@'localhost';"
composer install --no-interaction
php artisan migrate --database=testing --force
php artisan db:seed --database=testing --force
nohup bash -c "./vendor/laravel/dusk/bin/chromedriver-linux 2>&1 &"
nohup bash -c "php artisan serve 2>&1 &" && sleep 5
php artisan dusk

Some of the errors

1) Tests\Browser\DashboardTest::testMenuContent
Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body .navbar"}
(Session info: headless chrome=62.0.3202.75)
(Driver info: chromedriver=2.32.498513 (2c63aa53b2c658de596ed550eb5267ec5967b351),platform=Linux 4.2.0-42-generic x86_64)
Facebook\WebDriver\Exception\NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body textarea[name='email']"}
(Session info: headless chrome=62.0.3202.75)
(Driver info: chromedriver=2.32.498513 (2c63aa53b2c658de596ed550eb5267ec5967b351),platform=Linux 4.2.0-42-generic x86_64)
Failed asserting that '/' matches PCRE pattern "/^\/login/u".
20 Sep
1 year ago

troovers left a reply on Laravel Running Old Code

That's my initial thought too. I tried one solution which I hadn't done before, running php artisan optimize --force and suddenly, my problems where gone.

It's really strange that without the --force flag, it doesn't work on deployment, but with the flag, it does.

19 Sep
1 year ago

troovers left a reply on Laravel Forge Not Deploying

That's the general error Forge is showing users when a deployment hasn't been executed properly, because it could be the problem.

Is that the only feedback you're getting?

troovers started a new conversation Laravel Running Old Code

Hey guys,

I've got my application running on a Forge managed server, which deploys my code when changes have been made to the master branche.

For testing purposes, I added a Logging statement to my MessageSending event, which is fired when a mail is being send. It works great on my Laravel Homestead environment, but doesn't always get triggered on my production environment. The logging statement was meant for debugging, to check whether the code was being executed at all.

Once I figured out that it was sometimes running and sometimes not, I deleted the line which logged 'Jeej, you're being handled!'. However, around 20 deployments later, that line is still being logged.. My production environment is thus running old code.

I've tried many things which I read on the internet. For example php artisan clear-compiled, or composer dumpautoload. These made no difference however.

Does anybody know what the issue is?

My deployment script:

cd /home/forge/geekk.nl
git pull origin master
composer dumpautoload
composer install --no-interaction --no-dev --prefer-dist
echo "" | sudo -S service php7.1-fpm reload

if [ -f artisan ]
then
    php artisan cache:clear
    php artisan deployments:migrate
fi

php artisan horizon:terminate

And composer.json file:

...
},
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan ide-helper:generate",
            "php artisan ide-helper:meta",
            "php artisan clear-compiled",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
16 Sep
1 year ago

troovers started a new conversation Mailgun Custom Variables

Hey guys!

I'm using Mailgun to send my emails. I'm currently working on implementing tracking deliveries, opens and drops. For that I need to append custom variables to the mail with which I can identify the domain and recipients.

I've successfully implemented the event listener that listens to the MessageSending event. In the handle() method, I save the mail and its' recipients to the database, for later retrieval and logging purposes.

However, in that same method, I've got these lines of code:

// Add the info for event tracking with Mailgun
$this->swift_message->getHeaders()->addTextHeader("X-Mailgun-Variables", json_encode([
            'database' => Config::set('database.connections.tenant.database'),
            'mail'     => $this->email->id
        ]));

When I view the mails sent on development in MailHog, I see the above header. But when I test it on production, MailGun doesn't seem to recognize or even find the header.

The complete code of the handle() method:

/**
     * Handle the event.
     *
     * @param MessageSending $event
     * @return void
     */
    public function handle(MessageSending $event)
    {
        $this->swift_message = $event->message;

        $user_object = (array)$this->swift_message->getReplyTo();
        $user_email = key($user_object);

        // Get the user that sent the mail
        $user = User::where('email', $user_email)->first(['id', 'email', DB::raw(User::DISPLAY_NAME . ' AS display_name')]);

        // Retrieve the attachments from the message
        $attachments = $this->get_message_attachments();

        $this->email = Email::create([
            'user_id'      => !is_null($user) ? $user->id : null,
            'sender_name'  => !is_null($user) ? $user->display_name : 'Systeem',
            'sender_email' => !is_null($user) ? $user->email : '[email protected]',
            'subject'      => $this->swift_message->getSubject(),
            'content'      => $this->swift_message->getBody(),
            'attachments'  => implode(', ', $attachments)
        ]);

        // Get message recipients
        $addresses = $this->get_recipient_addresses();

        // Transform the addresses to members or sponsors
        $members = $this->get_member_recipients($addresses);
        $sponsors = $this->get_sponsor_recipients($addresses);

        // Combine them to a valid insert array
        $values = array_merge($members, $sponsors);

        // Add manual recipients for instance birthday mail bcc, which doesn't belong to a member
        $this->add_manual_values($values);

        DB::table('sent_emails_recipients')->insert($values);

        // Add the info for event tracking with Mailgun
        $this->swift_message->getHeaders()->addTextHeader("X-Mailgun-Variables", json_encode([
            'database' => Config::set('database.connections.tenant.database'),
            'mail'     => $this->email->id
        ]));
    }

Does anybody have the same issue, or can you help me figure it out? I'm pulling out hairs right now ;-)

01 Sep
1 year ago

troovers left a reply on Redis Queue & Horizon

Thanks for your help guys, I just found the solution! I had two sites running on my Forge server. They both used the redis queue driver and both added jobs to the 'default' queue. This led to the fact that the jobs are executed by one of the two sites. And because the other site did not have an active artisan horizon command, the jobs would not be executed. It thus seemed that site1 was handling the job, but in fact it was site2.

Renaming the queue of one of the applications solved the problem, the jobs are now added to the running horizon command of the correct application.

troovers left a reply on Redis Queue & Horizon

We do have the same config indeed. I know we're stabbing in the dark, but I've got no more information to provide you, than I've already given you.

Horizon displays all of the job's I'm passing on to the queue. When a job succeeds, I can't click on the job to view the details. But that's not a problem, the job succeeds anyway.

When a job failed, I can click it to view errors. When a job however isn't executed at all, I can in fact click it, but it doesn't display any errors. It just says:

ID: 38
On: default
Failed Time: 1970-01-01 00:59:59

And it displays the job parameters.

troovers left a reply on Redis Queue & Horizon

I tried one or two supervisor configs, didn't make a difference. I hadn't removed it yet.

troovers left a reply on Redis Queue & Horizon

Hi, thanks for your reply. I do indeed have a daemon running on Laravel Forge to keep the horizon command active.

The logs are not showing any errors, or info lines regarding this. Sentry is already active in the project, but does also not return an error.

It's indeed a real hard one..

troovers started a new conversation Redis Queue & Horizon

Hi guys,

I've upgraded to Laravel 5.5 this week and installed Horizon to monitor my queues. For that to work, I had to change the queue driver from database to Redis. I didn't expect much trouble caused by that switch. I was wrong, unfortunately.

I've managed to get Horizon up and running (easily) and configured the Redis queue driver. In my local environment, everything is working fine! Then I went live and I noticed that around 50% of my jobs aren't being executed. When I check the Horizon dashboard, about 50% of the jobs has a red cross behind them, but didn't fail. So, they didn't even fire. This doesn't happen to a specific job, it just happens randomly. For instance: sometimes a job succeeds five times in a row, and then isn't executed for three times. Pretty annoying as you can guess. But, because I got no errors whatsoever, debugging is a pain in the ass. Maybe you can help me with the problem. Below you'll find my configs.

config/queue.php

'connections' => [

        'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
            'queue' => 'default',
            'retry_after' => 60,
        ],

    ],

config/horizon.php

'environments' => [
        'production' => [
            'supervisor-1' => [
                'connection' => 'redis',
                'queue' => ['default'],
                'balance' => 'auto',
                'processes' => 10,
                'tries' => 3,
            ],
            'supervisor-2' => [
                'connection' => 'redis',
                'queue' => ['default'],
                'balance' => 'auto',
                'processes' => 10,
                'tries' => 3,
            ],
        ],

        'dev' => [
            'supervisor-1' => [
                'connection' => 'redis',
                'queue' => ['default'],
                'balance' => 'simple',
                'processes' => 3,
                'tries' => 3,
            ],
        ],
    ],

Thanks in advance!

  • Thomas