Erwin

Experience

8,730

1 Best Reply Awards

  • Member Since 2 Years Ago
  • 146 Lessons Completed
  • 1 Favorite

10th September, 2017

Erwin left a reply on Automate Filling Forms External Websites • 2 weeks ago

Thx @bashy. Will test it tomorrow.

8th September, 2017

Erwin left a reply on Automate Filling Forms External Websites • 2 weeks ago

I will try to explain it.

We receive water contracts for houses. These contracts have to be registered at the water company that provides the water to the houses. This is an manual action for the company that we word for. So every day they receive around 30 new water contracts and they have to register them manually.

So normally we would think let's use there API so we can automate this process. But the problem is, these companies don't have API's.

That’s the reason we are looking for a solution to automate this. Dusk does this very well, except like you mentioned it shouldn’t be used on production.

What other options do we have?

Erwin left a reply on Automate Filling Forms External Websites • 2 weeks ago

Hmm oke.

But any other solutions to makes this manual job automated? It's a recurring job and the have to copy and past the data from the system to the supplier page to singup a person. So I dont want to scape anything I want to submit real data on the website.

Erwin left a reply on Automate Filling Forms External Websites • 2 weeks ago

Do you know any tutorials where the use Dusk not as testing but for scaping sites? I found some sample code:

Erwin started a new conversation Automate Filling Forms External Websites • 2 weeks ago

Hello,

We are looking for a method to fill forms on external websites. Those websites don't have an api and filling these form is too much work doing it manually.

So someone suggested to do this using Dusk. But I need to run this from a controller because the client wants to start it when he wants.

Dusk is used for testing and this isn’t testing. Anyone how has some suggestions or information on people with the same case?

Kind regards,

Erwin

30th August, 2017

Erwin started a new conversation Laravel Collective Not Compartible With 5.5? • 3 weeks ago

Hello,

I have updated my project to 5.5 but I get an error in the console when running artisan commands.

[Symfony\Component\Debug\Exception\FatalThrowableError] Call to undefined method Illuminate\Foundation\Application::bindShared()

I think this has someting to do with Laravel Collective, so I changed the composer from:

"laravelcollective/html": "~5.0"

to:

"laravelcollective/html": "~5.4"

When I run the composer update I get the following errors:

Problem 1 - Conclusion: remove laravel/framework v5.5.0 - laravelcollective/html v5.4 requires illuminate/session 5.4.* -> satisfiable by illuminate/session[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9]. - laravelcollective/html v5.4.1 requires illuminate/session 5.4.* -> satisfiable by illuminate/session[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9]. - laravelcollective/html v5.4.2 requires illuminate/session 5.4.* -> satisfiable by illuminate/session[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9]. - laravelcollective/html v5.4.3 requires illuminate/session 5.4.* -> satisfiable by illuminate/session[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9]. - laravelcollective/html v5.4.4 requires illuminate/session 5.4.* -> satisfiable by illuminate/session[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9]. - laravelcollective/html v5.4.5 requires illuminate/session 5.4.* -> satisfiable by illuminate/session[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9]. - laravelcollective/html v5.4.6 requires illuminate/session 5.4.* -> satisfiable by illuminate/session[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9]. - laravelcollective/html v5.4.7 requires illuminate/session 5.4.* -> satisfiable by illuminate/session[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9]. - laravelcollective/html v5.4.8 requires illuminate/session 5.4.* -> satisfiable by illuminate/session[v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9]. - don't install illuminate/session v5.4.0|don't install laravel/framework v5.5.0 - don't install illuminate/session v5.4.13|don't install laravel/framework v 5.5.0 - don't install illuminate/session v5.4.17|don't install laravel/framework v5.5.0 - don't install illuminate/session v5.4.19|don't install laravel/framework v5.5.0 - don't install illuminate/session v5.4.27|don't install laravel/framework v5.5.0 - don't install illuminate/session v5.4.36|don't install laravel/framework v5.5.0 - don't install illuminate/session v5.4.9|don't install laravel/framework v5.5.0 - Installation request for laravel/framework 5.5.* -> satisfiable by laravel/framework[v5.5.0]. - Installation request for laravelcollective/html ~5.4 -> satisfiable by laravelcollective/html[v5.4, v5.4.1, v5.4.2, v5.4.3, v5.4.4, v5.4.5, v5.4.6, v5.4.7 , v5.4.8].

Is there an compatibility issue? Or is the first error not related to Laravel Collective?

Kind regards,

Erwin

10th March, 2017

Erwin started a new conversation Global Scope Different Options • 6 months ago

Hello,

I was wondering of this is a good solution or not. For the different roles in our systeem the global scope on for example the company table has to be different. So I have dont the following:

public function apply(Builder $builder, Model $model)
{
    if(Auth::user()->hasRole('accountmanager')) {
        $companies = Auth::user()->users()->whereNotNull('company_id')->pluck('company_id');
        $companies[] = Auth::user()->company_id;
        $builder->whereIn('id', $companies);
    }

    if(Auth::user()->hasRole('intermediair')) {
        $builder->where('companies.company_id', Auth::user()->company_id);
    }
}

What do you think? Is there a better solution or is this just fine?

Kind regards,

Erwin

19th February, 2017

Erwin left a reply on Posting To Login Form Results In Redirect To Root Domain • 7 months ago

I have tested with dusk, but I prefered the application testing of 5.3 more. Dusk is so slow with opening the browser. One simple test to login to the application takes 32 seconds.

Imagine if you have like 20 tests.

Erwin left a reply on Posting To Login Form Results In Redirect To Root Domain • 7 months ago

How does the validation determine the redirect back? When you are testing you POST directly to the store function. Could this be the issue that it's redirecting to the index because there is not redirect back info?

18th February, 2017

Erwin started a new conversation Posting To Login Form Results In Redirect To Root Domain • 7 months ago

Hello,

I am testing with tests and when I run an invalid login and check if the assertRedirect is the login page again, because of the invalid login it gives me the error that the redirect is different.

My test:

/**
 * Try to login with invalid credentials
 *
 * @return void
 */
public function testInvalidLogin()
{
    $response = $this->post('login', ['username' => '[email protected]', 'password' => 'blaat']);
    $response->assertRedirect('login');
}

The result is: https://i.imgur.com/I4grVj6.png

Why is it redirecting to the root and not back to the login page?

Kind regards,

Erwin

10th November, 2016

Erwin left a reply on Laravel Testing Select Not Working • 10 months ago

Found the issue. The value of the options wasnt set, so the option wasnt found. Stupid mistake.

Erwin left a reply on Laravel Testing Select Not Working • 10 months ago

Moved the topic to the testing forum. Anyone how was an solution?

9th November, 2016

Erwin started a new conversation Laravel Testing Select Not Working • 10 months ago

Hello, I am making a test to verify if my customer create form works. The country select is popupated using an view composer. When I run the test I get the error: InvalidArgumentException: Input "country_id" cannot take "1" as a value (possible values: ). I have the feeling that view composers aren't executed when running tests. Any options to solve this issue? Kind regards, Erwin

6th October, 2016

Erwin left a reply on Why You Cache Like This? • 11 months ago

Are you sure the old one is deleted? Don't think this has anything to do with Laravel.

Erwin left a reply on Why You Cache Like This? • 11 months ago

Are u using the same name for the new image? Maybe it's your browser cache.

31st August, 2016

Erwin left a reply on Same Route, Different Route Group • 1 year ago

Thx cipsas, that will do the trick!

Erwin started a new conversation Same Route, Different Route Group • 1 year ago

Hi Guys! We are working on an app where we use some resources routes. The app has two seperated enviroments. The backend and the frontend. Both enviroments have a product resource controller.

16th May, 2016

Erwin started a new conversation Update VUE Data Object In Different Component • 1 year ago

Hi Guys! I have an component which is globally used. When the person save any thing in this component, I would like to update the data object in an different component. Is this possible with Vue? The second component where I want to update the data object shows the data in an table, but this is different from the component where people can save items. Kind regards, Erwin

11th March, 2016

Erwin left a reply on Retrieve Input After Validation Failed In View • 1 year ago

Oke so posted this a bit to fast. Used old() function.

Erwin started a new conversation Retrieve Input After Validation Failed In View • 1 year ago

Hi,

I can't find how to retrieve the user input in the view after the validation failed. I need this to loop thru them so i can show the dynamic fields that where created using jQuery. Normaly from the controller i would do: return view('backend.customer.email', [ 'input' => Input::all() ]); But when i validate the controller isn't executed this far.

Any ideas how to solve this?

Kind regards, Erwin

18th December, 2015

Erwin left a reply on [MySQL] Headache Formula • 1 year ago

Thanks for your answer.

What do you exacly mean with:

"I think a better option would be to add a few columns to the table that break apart the actual box values from their dimensional relation."

You say that I have to ignore the fact that a value is the width?

I think my formula for calculating the percentage is wrong for some reason. Because sometimes i get weird results at the top while these shouldn't be there.

Erwin started a new conversation [MySQL] Headache Formula • 1 year ago

Hi Guys,

We have a searchegine to search true box sizes. People fill in the with, height and the length. We search thru the DB using the input and show the best results sorted in matche percentage. We calculate it like this:

CEIL((((210 / width) * 0.333) + ((270 / length) * 0.333) + ((120 / height) * 0.333)) * 100) as pcnt1

210, 270 and 120 are the user input. This is working fine, but we want to extend this so it will also check if other combinations has matches to. So instead of W = W, H = H and L = L we want to check for W = H, H = L, L = W and W = L, L = H and H = W. What is the best way to do this so we can calculate the match percentage and sort in to this result. Any suggestions?

Kind regards,

Erwin

30th September, 2015

Erwin left a reply on Error Exception Email In Laravel • 1 year ago

I am having the same issue. I can send email everywere, but can't send any from the report function in the App\Exceptions\Handler.php. It shows me a whitepage.

15th September, 2015

Erwin started a new conversation Skip Route When Notihing Found • 2 years ago

Hi Guys,

We want the following:

Route::get('{name}', 'BlogController@show');

{name} is dynamic and the routes should only be done when the {name} is found in the database. So i though i make an middleware function and i nothing is found continu to the next route. This doenst work.

Is there any way to fix this? Because other routes also need to keep working that don't have anything to do with the blog.

Any ideas how to solve this? I would need some thing like an condition to see if anything is found in the DB and else skip the route and continu.

Kind regards,

Erwin

9th September, 2015

Erwin started a new conversation ENV File Not Loaded • 2 years ago

Hi Guys!,

I am experiencing some weird behavior. If I refresh an call like 5 times. One of these calls the database connects to the default settings except for the settings of the env file. Any one else is having this weird behavior? Is there a fix for this?

Kind regards,

Erwin

10th July, 2015

Erwin started a new conversation Extra Fields Registration Auth • 2 years ago

Hi Guys!

I have extended my auth with an confirmation code so people can confirm there email address. I have added the extra field to the migration user file. Extended the fillable in the user model an create the account with the following:

$request->input('email'), 'password' => $request->input('password'), 'confirmation_code' => str_random(30) );
    $this->registrar->create($create);

?>

For some reason it skips the confirmation_code. It's null in the database. What else do i have to do to allow an extra field in the user table?

Kind regards,

Erwin

21st June, 2015

Erwin started a new conversation API Centric Design Authentication • 2 years ago

Hi Guys,

I am working on a tool where I want to build all platforms using one API. First thing we will build will be an browser version (managed by us) where pleople can login an execute all kinds op options. All of these action have to be send to the API.

What i was thinking about for authentication is the following:

User can login using his username and password. This API call will be send with an general public and secret key to secure the API call. So stuff like the params, secretkey and timestamp will create an HMAC signature to validate the API call.

After this login all other API calls will be send using an user owned public and secretkey that the user will get after the login command.

Few issues i see working like this are:

  • After login the API returns the public and secret key owned by the user, but I guess this isnt very secure because i will have to send the secretkey as an response! How could i secure this? This API login command will only be used in the frontend build by us. It will not be used by 3th party apps.

  • How do I store the secretkeys of the users? All users will get there own secretkey, but i dont want to just save them plain text in the DB and i also cant hash them one way, because then i cant us the secretkey to validate API calls.

The class i have found to get this working in Laravel is https://github.com/philipbrown/signature-php. It's working fine.

Any thoughs about my concerns? How should i secure these issues?

Kind regards,

Erwin

25th March, 2015

Erwin left a reply on Basecamp API • 2 years ago

Here someone did it, but is like 11 months old.

https://github.com/mrberggg/php-basecamp

Erwin left a reply on Max Login Attempts Laravel 5 Auth • 2 years ago

Made a smillar solution.

In the eventServiceProvider.php i added:

    public function boot(DispatcherContract $events)
    {
        parent::boot($events);

        //save login attempts
        Event::listen('auth.attempt', function($event)
        {
            $attempt = new Attempt();
            $attempt->newAttempt(Request::getClientIp());
        });
        
        //remove login attempts after succes login
        Event::listen('auth.login', function($event)
        {
            $attempt = new Attempt();
            $attempt->deleteAttempt(Request::getClientIp());
        });
    }

And i made a middleware class to use in my getLogin and postLogin route to validate if the user tried to many times. I am alway open to code suggestions. If this isnt the way to go it like to hear if ofcourse.

Erwin left a reply on Max Login Attempts Laravel 5 Auth • 2 years ago

Well i prefer to do it with my simple code. I will try to fix the issue using an middleware so I can validate the route to the auth/login page.

Erwin started a new conversation Max Login Attempts Laravel 5 Auth • 2 years ago

Hi Guys,

I have created a new table to manage login attempts. When someone tries to login I use the auth.attempt event to save an login attempt. When auth.login event is fired i will delete all login attempts because the user has used valid credentials.

The next step is where to put the check if a user has tried to login like 5 times in the last 15 minutes. What would you guys sugest? I dont want to copy all the code of the AuthenticatesAndRegistersUsers to the AuthController.php. So what would be the best place to add the check if someone hasnt tried to login 5 times in the last 15 minutes.

Kind regards,

Erwin

21st December, 2014

Erwin left a reply on View Composers In Laravel 5 • 2 years ago

It sure is!

Erwin left a reply on View Composers In Laravel 5 • 2 years ago

Oww wow, that easy.

I added the ComposerServiceProvider to the list of other app service providers like:

        'App\Providers\AppServiceProvider',
        'App\Providers\EventServiceProvider',
        'App\Providers\RouteServiceProvider',    
        'App\Providers\ComposerServiceProvider',

Never though that this would be an issue. Thanx for answering!

Erwin started a new conversation View Composers In Laravel 5 • 2 years ago

Hi Guys,

I have this code running on Laravel 4 and i though lets test around with version 5. I need a global var so i created an view composer.

I added the ComposerServiceProvider to the App/Providers folder but i get an error. This is my code:

<?php namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class ComposerServiceProvider extends ServiceProvider {

public function register()
{
    $this->app->make('view')->composer('index', 'App\Http\Composers\Boxes');
}

}

I am having issues with the "$this->app->make('view')" part. The error is Class view does not exist.

Any one how can point me in the right direction to solve this?

Erwin

30th November, 2014

Erwin left a reply on Laravel Very Slow On View:make • 2 years ago

Found the issues, using an wildcard at:

$this->app->view->composer('*', 'Project\Composers\TotalComposer');

Isn't a good idea. This slows down the app big time. Changed it to the pages i need it for and now the page is at normal speed again.

29th November, 2014

Erwin left a reply on Laravel Very Slow On View:make • 2 years ago

Deploying an old commit to my live enviroment and that one I still fast. Page loads of 115 ms! So from there I am going to check what has changed since the commit it was still fast and the current commit.

Erwin left a reply on Laravel Very Slow On View:make • 2 years ago

Removing this part of my view: @include('layouts.search') save 1 sec. When i remove all content of that view its still slow. So it looks like the include option is slow or something?

Erwin left a reply on Laravel Very Slow On View:make • 2 years ago

Yes I am using blade templating with the extend method in the view (@extends('layouts.default')). When i remove all content of the view so that it loads just an empty view it tkes 1.22 sec. When i remove all content between the @section('content') it takes 2 sec.

Erwin started a new conversation Laravel Very Slow On View:make • 2 years ago

Hi Guys!

I am have an issues with the speed of Laravel. Local loading the index takes 3 secs, but when i remove the return View:make it loads in 158 ms. Any thoughs how this is possible? The only things that hapen in the view is retrieving the data of an composer and generating some forms. Thats all.

Whats the best way to see what happens?

Kind regards,

Erwin

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.