Ronster

Ronster

Member Since 5 Years Ago

Leeuwarden

Experience Points 11,575
Experience Level 3

3,425 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 134
Lessons
Completed
Best Reply Awards 5
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.

20 May
2 months ago

Ronster started a new conversation Looking For The Best Approach

Hi,

In my company we have a lot of background job running to update a lot of data. besides that we also have a team of data validators who update the same data in our backend system. Currently it sometime shappens that our schedled jobs update data that has manually been process by one of our team members.

basically i'm wondering what would be the best way to prevent scheduled jobs update data that has previously been adjusted by a human. I was thinking about some locking functionaly but i'm not sure what the best approach for this would be.

any ideas here?

Thanks

23 Jan
1 year ago

Ronster left a reply on Custom Cache Driver In 5.5

any toughts?

22 Jan
1 year ago

Ronster left a reply on Custom Cache Driver In 5.5

It's in the boot method.

It looks like it's calling the resolve method on the CacheManager before the extend method is beeing called.

Ronster started a new conversation Custom Cache Driver In 5.5

Hi,

I have 2 other apps running on 5.3 and both are using this cache driver: https://github.com/ethanhann/Laravel-RedisStore

i am creating a 3rd app and want to use the same cache driver but in laravel 5.5 i'm constantly getting an error saying that Driver [ehann-redis] is not supported.

the thing is that as soon as i change the redis.driver config value to ehann-redis] it's immediately failing. the AppServiceProvider's boot method is not even beeing called. also my custom CacheServiceProvider.php file isn't beeing called.

AppServiceProvider.php

Cache::extend('ehann-redis', function ($app) {
            return Cache::repository(new \Ehann\Cache\RedisStore(
                $app['redis'],
                $app['config']['cache.prefix'],
                $app['config']['cache.stores.redis.connection']
            ));
        });

config/cache.php

'redis' => [
            'driver' => 'ehann-redis',
            'connection' => 'default',
        ]

I also logged an issue on this in november but nothing happened on that.

Does anybody expierenced the same or has an idea how to get this fixed?

thanks

25 Sep
1 year ago

Ronster started a new conversation Heroku Application Cache On Workers

Hi,

I have setup an app on heroku leveraging queues (SQS).

I want to know how the application is beeing used on workers. I ask this becuase I am facing a serious issues with worker dyno's.

I have 2 jobs on the queue and for some reason the 2nd job is on the same instance of the framework then the 1st one. Facades are not initialized causing some config I send for a api call not get's updated.

I there anybody here that can explain how I could fix this?

thanks

21 Sep
1 year ago

Ronster started a new conversation Wierd Heroku Behaviour

Hi,

I'm having an app on Heroku using 1 web dyno and 1 worker dyno. my application handles large files on a per user basis.

the problem is as follows: let's say we have user A and user B. user a does a request form an external application to mine and this will result in a queued job. so eventually this will be processed on the worker dyno. the queued job has details about the logged in user so we can log him in once the job is beeing processed. all goed well!

now user B does a request which also will result in a queued job. details are passed in i can successfully login this user. but now when I process a task details of user A are coming up. it feeld like the application is cached for some reason since old instance are showing up with data from previous job.

I have an instance of an oauth client. when the queued job is done I currently set it to null for debug purposes. this client is initiated by the code with configuration. the weird thing is is that when user b does a call after user a this instance is still null and is not beeing reinitiated which i would expect. this oauth client gets it's config via a class called by a facade.

the funny thing is that when running this without a queue it all works perfectly (on the web dyno)

hopefully someone here can help me figure out what happens. i'm working for 4 days on this already.

26 Apr
2 years ago

Ronster started a new conversation DomDocument SchemaValidate Has Different Behaviour

Hi,

I'm having an XML file which I want to validate with domdocument.schemaValidate. locally on homestead the XML file validation passes but on my remote app on Heroku the same file and xsd is giving me a validation error.

I have no clue where to look to solve this. according to online validator the behavious on Homestead is the right one.

are there any PHP vars involved? or any other tips I can use to fix this on heroku?

thanks

14 Apr
2 years ago

Ronster started a new conversation XML Feeds URL Works In Browser But Get Timeout When Using CURL

Hi,

I have access to a few XML feeds which I can access via the browser with success. however when trying to request them via PHP and cURL I get a connection timed out error. it's the exact same URL which worked a few hours ago.

are there any global DNS issues? or does somebody have an Idea what to check?

thanks

13 Mar
2 years ago

Ronster left a reply on Laravel With Proxysql

what version of proxysql are you rinning?

12 Mar
2 years ago

Ronster left a reply on Laravel With Proxysql

That is exactly what we are facing. I found this post https://groups.google.com/forum/m/#!msg/proxysql/veNBU5z-ikQ/iaSkGofIBwAJ but do Not know yet if it helps...

10 Mar
2 years ago

Ronster started a new conversation Laravel With Proxysql

Does anybody here has laravel working with proxysql? I'm hearing things that it doesn't work together.

Can anybody confirm that or give information about there setup?

Thanks

09 Feb
2 years ago

Ronster started a new conversation Preventing Access To Related Models

Hi,

I'm in the middle of building an API and i'm using league\fractal for it.I need to prevent access to some models and i'm achieving that by using policies.

what is the best way to prevent access to a eager loaded relationships. for yhe ones that know fractal, you can pass includes via request uri. in my case some users do have access to them and some don't

how can I achieve this in a nice way? ofcourse I can check access in the transformer itself but I was wondering if there is any other option.

thanks

15 Dec
2 years ago

Ronster left a reply on Package Auth Middleware

Solved! seems I had to use the web middleware in my route files and then in the controller constructor check the auth middleware.

Ronster started a new conversation Package Auth Middleware

Hi,

I'm currently in the middle of creating a package for my company. This package needs to use the auth middleware which is giving me troubles at the moment.

It seem like the package cannot access the current session or something. I have the following route in my package

Route::group(['prefix' => 'support', 'middleware' => ['auth'], 'namespace' => 'RonnieVisser\Core\Http\Controllers\Support'], function() {
    Route::resource('targets', 'TargetController', [
        'names' => [
            'index' => 'web.support.targets.index',
            'update' => 'web.support.targets.update',
            'store' => 'web.support.targets.store',
        ]
    ]);
});

when hitting this route it redirects me to /login which, on his turn, redirects me to /home. If I remove the auth middleware hitting the route works but the application thinks that i'm a guest and is showing login buttons etc.

in my composer.josn file fo the package I require "laravel/framework": "~5.3". is there something more I need to do here?

thanks

13 Dec
2 years ago

Ronster started a new conversation How To Let Composer Use Private Packages

Hi,

I have created an app that uses some composer packages created by our organization that are private repositories. I have issues to include these packages on my homestead environment. Our production code lives on Heroku and over there it's no issue since we can simply add a ENV variable.

Note: I have replaced the org and package name respectivly to vendor and package

what I have done so far:

  1. added my id_rsa.pub key to github.
  2. added a repositories section in my composer.json file.
"repositories": [
        {
            "type": "vcs",
            "url":  "git://github.com/vendor/package.git"
        }
    ],
  1. added the package in the require section
"vendor/package": "dev-master"

when doing a composer update the following error occurs: [Composer\Downloader\TransportException] The "https://api.github.com/repos/vendor/package" file could not be downloaded (HTTP/1.1 404 Not Found)

What do I need to do more get access to the private repos on my heomstead environment.

thanks

02 Dec
2 years ago

Ronster left a reply on Get Row Count When Using Skip And Take

93200 records.

I don't want to remove the skip and take since I want to know how many records are in there. mostly it's the same as take execpt for the last iteration.

Ronster started a new conversation Get Row Count When Using Skip And Take

I'm having a query uses skip and take to query a postgres database. I only need the totals en don't want to do a select to get these.

current when doing a count() it returns the count of the full query, I actually want the count of the real results of the query.

Here is an example:

Model::skip(100)->take(50)->count(); 

how could this be achieved?

04 Nov
2 years ago

Ronster left a reply on Vue Component Ready Not Fired

That helped :) Thanks

Ronster started a new conversation Vue Component Ready Not Fired

Hi,

I have this component

<template>
    <div id="substitution">
        <div class="ui sub header">Selecteer een wedstrijd</div>
        <select name="skills" class="ui fluid normal dropdown">
            <option v-for="match in matches" v-bind:value="match.id">{{ match.hometeam }} - {{ match.awayteam }}</option>           
        </select>

        <div class="ui segment">
            <div class="ui active inverted dimmer">
                <div class="ui text loader">Loading</div>
            </div>
            <p>sfdgsdfgdsfgdfsg</p>
            <p>sfdgsdfgdsfgdfsg</p>
            <p>sfdgsdfgdsfgdfsg</p>
        </div>
    </div>
</template>

<script>
    export default {
        /*
         * The component's data.
         */
        data() {
            return {
                matches: []
            };
        },

        /**
         * Prepare the component.
         */
        ready() {
            alert('ff');
            this.getMatches();
        },

        methods: {
            getMatches() {
                //this.$http.get('/api/matches')
                //    .then(response => {
                //        this.matches = response.data;
                //    }
                //);
            }
        }
    }
</script>

and this is my app.js


/**
 * First we will load all of this project's JavaScript dependencies which
 * include Vue and Vue Resource. This gives a great starting point for
 * building robust, powerful web applications using Vue and Laravel.
 */

require('./bootstrap');

/**
 * Next, we will create a fresh Vue application instance and attach it to
 * the page. Then, you may begin adding components to this application
 * or customize the JavaScript scaffolding to fit your unique needs.
 */

Vue.component(
    'team-players',
    require('./components/Substitution.vue')
);

window.addEventListener('load', function () {
    const app = new Vue({
        el: '#app'
    });
});

for some reason the ready method is not being fired. I don't have the feeling i'm missing something but apparently I do. The html is rendering perfectly.

any ideas?

01 Nov
2 years ago

Ronster left a reply on Database Setup For Tests Issue

yes I'm using different Db for testing. Can I use database transaction and use my own setup?

Ronster started a new conversation Database Setup For Tests Issue

Hi,

I have some weird issues going on regarding the creation of a database when creating testcode for the application. The problem is as follows:

First of all I'm not able to make use of the DatabaseMigration trait since I have migration files in to different directories. the reason for that is because we are working on a multi tenant structure where every account get's it's own schema. which is migrated directly when the account is created. so because of this i'm using the setUp and tearDown methods of PHPUnit to migrate the database, and this is where the troubles begin.

this is my code:

public function setUp()
    {
        Parent::setUp();

        $this->artisan('migrate', ['--path' => 'database/migrations/', '--database' => 'shared_testing', '--force' => true]);
        $this->artisan('migrate', ['--path' => 'database/migrations/tenants/schema/', '--database' => 'shared_testing', '--force' => true]);
    }

    public function tearDown()
    {
        Mockery::close();

        $this->artisan('migrate:reset', ['--path' => 'database/migrations', '--database' => 'tenant_testing']);
        $this->artisan('migrate:reset', ['--path' => 'database/migrations/tenants/schema', '--database' => 'tenant_testing']);

        Parent::tearDown();
    }

the problem I have is that the migrstion file is not being filed with the migration and therefor the migrations always fail since there are duplicate tables.

31 Oct
2 years ago
20 Oct
2 years ago

Ronster started a new conversation Queues & Supervisor

Hi,

I'm having a few queues that handle stat of different games (sports). The queue is called by a script in a cron job which puts 11 jobs onto the queue, each with a delay of a few seconds.

approximately 1 time per day the queue stops working and isn't processing any jobs. when looking at the queue in forge it's says it's still running. also no errors in the worker.log file is present. The queues are setup as a deamon and I have the following supervisor script

[program:laravel-worker] process_name=%(program_name)s_%(process_num)02d command=php /home/forge/livegames/artisan queue:work beanstalkd --sleep=3 --tries=1 --queue="livescores,livescore_yesterday,weather" autostart=true autorestart=true user=forge redirect_stderr=true stdout_logfile=/home/forge/livegames/worker.log

What could be the problem here? I have the feeling supervisor should do something but it seems like it isn't.

thanks

13 Oct
2 years ago

Ronster left a reply on Parse Date With Nanoseconds

that's indeed what i'm doing now! however it doesn't feel solid.

Ronster left a reply on Parse Date With Nanoseconds

that has microseconds, mine has nanoseconds which doesn't parse.

Ronster started a new conversation Parse Date With Nanoseconds

Hi,

I have a date in the following format "2016-10-07T23:59:59.9999999999".

How can I parse this to a valid DateTime instance? seems PHP can only handle a 6 digit microseconds. not a 9 digit nanoseconds.

28 Sep
2 years ago

Ronster started a new conversation Weird API Route Thing

Hi,

I'm working with L5.3 and I have a middleware in place that sets a postgres schema based on the loggedin user. This is working fine for web routes. however when a post to the api routes comes in, using the same middleware, it seems that the middleware is executed but that the schema is not set on the config/database.php file.

are API routes treated different then web routes? or does anybody has a clue what I can do to solve?

thanks

27 Sep
2 years ago

Ronster started a new conversation Load Balancer And Rate Limiter Issues

Hi,

Last weekend we have added a load-balancer for our api since the server is constantly very busy. currently the load balancer balances between 2 servers. on this 2 servers we have the throttle functionality to limit hourly requests. these are stored on a memcached server outside of the 2 api servers.

we are constantly receiving message from clients which tell me that the get a 429 message. some say that between 2 request the limits left has changed with 100 calls.

I can't seems to fixture our what is causing this. Is there somebody here that has experience with this?

any tip is welcome!

thanks

19 Sep
2 years ago

Ronster started a new conversation Setting Right Database For Test

Hi,

I use the model connection attribute in all my models since i'm working with multiple databases/schema's. I'm at a point where I need to write tests and this is where I'm struggling with at the moment.

At the moment I set the DB_Connection through the models constructor. I named it "SHARED_CONNECTION"

public function __construct()
    {
        Parent::__construct();

        $this->setConnection(
            env('SHARED_CONNECTION')
        );
    }
```

In the browser this works like expected and my app functions as expected. Now, when writing tests, I get a lot of errors. first of all I have updated the phpunit.xml file with the "SHARED_CONNECTION" env variable and set it to a sqlite database (in memory later).

```xml
<env name="SHARED_CONNECTION" value="shared_testing"/>
```
I'm using faker to generate an account and a user.
```php
$factory->define(App\User::class, function (Faker\Generator $faker) {
    return [
        'name' => $faker->name,
        'email' => $faker->email,
        'password' => bcrypt(str_random(10)),
        'remember_token' => str_random(10),
        'account_id' => function () {
            return factory(App\Account::class)->create()->id;
        }
    ];
});
```
when running the tests we now get the following error:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: accounts.name
when setting the $connection property directly the account is being inserted.

So it looks like the constructor is not being called of something when running tests.

What is the best way to handle this? 
13 Sep
2 years ago

Ronster left a reply on Multiple Postgres Schema's

do you have any best practices to get the authenticated user in a service provider?

Auth::user()

doesn't work, also

public function boot(Request $request)
{
        dd($request->user());
}

doesn't work.

Ronster left a reply on Multiple Postgres Schema's

Very clever!

So in the service provider you are able to detect the current user?

12 Sep
2 years ago

Ronster left a reply on Multiple Postgres Schema's

Yes I am aware of that but I personally want to set this on a model so that I don't have to call that before every database call. but per model.

the problem is that in 5.3 the user isn't available in any constructor or whatsoever.

Ronster left a reply on Multiple Postgres Schema's

The structure is the same for every account. I just want give every customer their own schema since the data that will be stored is of high privacy risk.

I looked at a package: https://github.com/pacuna/Laravel-PGSchema which does what I need but I'm having issues to determine the schema based on the current user.

So basically i'm looking for a solution to retrieve user info and to use that to set the schema per model.

Ronster started a new conversation Multiple Postgres Schema's

Hi,

For my app, which is build on top of Laravel 5.3, I need to have multiple postgres schema's. I'm trying to use middleware to get the current user and to determine the account he belongs to. Every account should get it's own schema.

The user can be retrieved but I have no idea how to set it on the model. I tried to set a session from the middleware and consume that in the model constructor but it seems that the constructor if fired earlier then the middleware.

What is best practice for this?

thanks!

09 Sep
2 years ago

Ronster left a reply on Session In The Constructor

We are handling sensitive data so we want to separate every account that is active. the idea is to have separate schema's, 1 per account. the public schema contains accounts and users. we don't have things like subdomains etc. all url's are the same.

I need account information as early as possible but have no idea what the best is to achieve that!.

08 Sep
2 years ago

Ronster left a reply on Session In The Constructor

if that's so. what is the best solution determine the account for a multi tenant app?

Ronster left a reply on Session In The Constructor

it always return null. although i am logged in.

Ronster started a new conversation Session In The Constructor

In the upgrade guide of Laravel 5.3 there is an example of how to get session data in a controller constructor.

$this->middleware(function ($request, $next) {
            $this->user = Auth::user();
            return $next($request);
        });

Apperantly the above doesn't so i'm looking for a way access the current user. the reason why is because I need to work with multiple schema's in progress and need to set those on the model.

thanks

16 Aug
2 years ago

Ronster started a new conversation API Throttling Variable Limits

Hi,

I'm using spark so I am using subscription billing. Each plan can have a different rate limit. for example, the pro plan may be called every second and basic plan 500 times an hour.

I try to figure out how to solve this but cannot get my mind to it.

another issue I'm facing is that when is set the throttle middleware on the route it still is using the limit set in the Kernel.php file and every calls counts twice.

The first issue is the most important one currently, so hopefully somebody can help me in the right direction. I basically need to load plan details (DB call) and then set the throttle:amount,time.

thanks

14 Jul
3 years ago

Ronster started a new conversation Parallel Queues On Homestead

Hi All,

For an app I'm currently building I have to do some benchmarking. there I need beanstalkd to run queued jobs parallel.

I have already created a lara-worker.conf file and set the num_procs to 12. What else do I need to do make use of multiple processes?

I'm running the queue like this:

php artisan queue:work --daemon --tries=1

Any tips will be appreciated!

11 Jul
3 years ago

Ronster left a reply on Homestead - Postgres 9.5

Yeah I did that but was hoping by updating homestead it will go to 9.5 in the same run.

I don't feel comfortably with manually updating so I guess I have to wait then :)

Ronster started a new conversation Homestead - Postgres 9.5

Hi,

I need postgres 9.5 in homestead but have no idea ho to get is done. Anybody here that can point me into the right direction?

thank you!

08 Jul
3 years ago

Ronster left a reply on Trials Not Given

The problem with my issue was that I was loading the plans from database.

I explicitly had to cast the Db value fro trial days into an integer. same as for price.

06 Jul
3 years ago

Ronster left a reply on Set Schema On Model For PostgreSQL DB

In our case we have a user and account table in the public schema. all other tables should be schema dependent.

so what I have come up with is a setSchema() method in a trait that every model uses. for the user and account models we default to the public schema and for the others models we set it to the schema provided from the account record.

the setSchema() method is called form the model's boot method and injects the current authenticated user to determine the account schema.

Ronster started a new conversation Set Schema On Model For Postgres DB

Hi There,

I was wondering what the best way is to set the schema a model should use when using a PostgreSQL database,

I'm in the middle of setting up a multi-tenant system where every customer has it's own schema.

Who has experience with this and can point me into the right direction?

thanks, Ronnie

28 Jun
3 years ago

Ronster started a new conversation Stage Ratelimiter Issue

Hi,

Since a couple of days I have a real strange rate-limiter issue and I cannot find where it's going wrong.

I have set my ratelimit to 24,1. every hit on my api endpoint is counted double and as soon a 6 hits are being made the "x-ratelimit-remaining " header goes from 12 to 24 and on next request it's 0.

Also if I customize the ratelimit in the routes it's not taken. still the values from Kernel.php is used. My routes aren't cached or something.

I there anybody here with a great idea why this is happening?

Thanks

23 Jun
3 years ago

Ronster left a reply on Homestead & Queues

Seems like specifying a specific queue solves the problem..

Ronster left a reply on Homestead & Queues

Yes it is, I can see job being pushed on the queue. They immediately go to current-job-ready but also stay there.

queue:work doesn't help also. Any other suggestions?

Ronster left a reply on Homestead & Queues

I already followed that page. it looks like my jobs aren't fired from the queue or something