brunowerneck

brunowerneck

Member Since 3 Years Ago

Experience Points 11,550
Experience Level 3

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

21 Feb
1 year ago

brunowerneck left a reply on Laracasts Flash With Form Validation Errors

You can edit the file app/Exceptions/Handler.php and add the following to the report method:

/**
     * Report or log an exception.
     *
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
     *
     * @param  \Exception  $exception
     * @return void
     */
    public function report(Exception $exception)
    {
        if ($exception instanceof ValidationException) {
            foreach ($exception->validator->errors()->all() as $message) {
                flash($message)->error();
            }
        }

        parent::report($exception);
    }

27 Jan
2 years ago
11 Jan
2 years ago

brunowerneck left a reply on Windows + Homestead + Webpack Not Working Properly

@Stereotip42

On my gulpfile.js I had to add the following BrowserSync configuration. Pay attention on the proxy, files and watchOptions configurations.

.browserSync({
            proxy: 'myproject.dev',
            files: [
                './app/**/*',
                './config/**/*',
                './public/**/*',
                './resources/**/*',
                './routes/**/*',
            ],
            watchOptions: {
                usePolling: true,
                interval: 500
            },
            notify: false,
            open: false
        });

If you don't have BrowserSync installed, don't worry, next time you run npm run dev it will give you a link to install it.

If you can understand Portuguese, I have a video demonstrating this. If you don't, I think you can mute and follow along because it's that easy.

https://youtu.be/T2BISN1MsJk?t=8m30s

05 Jan
2 years ago

brunowerneck left a reply on Laravel 5.4 And Axios

@Eco012390 in the bootstrap.js file, but you can put it anywhere, just make sure it loads before you send your API queries.

31 Dec
2 years ago

brunowerneck left a reply on Laravel 5.4 And Axios

@ctf0 It was a no go, same error, but that gave me a different idea and I got it working like this:

axios.defaults.headers.common['X-CSRF-TOKEN'] = document.querySelector('meta[name="csrf-token"]').getAttribute('content');

Thanks everyone for your help. Happy new Year!

30 Dec
2 years ago

brunowerneck left a reply on Laravel 5.4 And Axios

@ejdelmonico Since there is nothing confidential in this project yet, I've posted the code to Github so you can take a look if you want

https://github.com/brunowerneck/lara54_axios

brunowerneck left a reply on Laravel 5.4 And Axios

@ejdelmonico I've installed Vue-Resource and set the CSRF Headers and it worked as before. I'm ditching Axios for the moment and stick to Vue-Resource.

brunowerneck left a reply on Laravel 5.4 And Axios

@ejdelmonico I did exactly the same thing I did in other projects I have using L5.3.

The only difference in this project, is that instead of using Vue.http from Vue-Resource, I'm using axios.

brunowerneck left a reply on Laravel 5.4 And Axios

Here's the request and response:

http://prntscr.com/dpss07

The Vue Component:

http://prntscr.com/dpss7x

The Controller:

http://prntscr.com/dpssld

brunowerneck left a reply on Laravel 5.4 And Axios

@ejdelmonico I'm using it directly, since it's being registered in the window DOM, in the bootstrap.js file.

axios.get('/api/user').then(...).catch(...)

Doing your procedure and then calling Vue.$http.get(... produces the same effect.

@keevitaja Yes, they are defined in the bootstrap.js file

brunowerneck started a new conversation Laravel 5.4 And Axios

I've done a fresh install of the latest development version of Laravel 5.4 and I'm trying to "consume my own API", following the guide in the Laravel 5.3 documentation for installing Passport.

Whenever I try to make an ajax request to the api, like /api/user, I get the Unauthorized error, even though I followed all steps in the documentation.

In a regular 5.3.* installation, using Vue-Resource, it works like a breeze, but it is not working in Axios.

I can, however, create routes in the web.php routes file and query them using Axios with no further problems.

Does anyone have any idea of how to consume our own API using the API middleware and Axios?

brunowerneck left a reply on Vue.js 2 Search

When you use regular javascript syntax, the "this" keyword reffers to the function being run.

This means that when you call this.searchname, it's looking for searchname inside your closure function and therefore it is undefined.

To fix it, you can do the .bind(this) at the end to "bind" the "this" keywork into your closure or use a temp variable, like the following:


search: function () {
    var that = this;
    return this.posts.filter(function (value) {
      
      return value.name.indexOf(that.searchname) >= 0;
    })
  }

However, I recommend using ES6 syntax, so you can use the keyword "this" without problems:


search() {
    return _.filter(this.posts, post => post.name.indexof(this.searchName) >= 0 
}

Note: the above example also uses lodash and I fixed your var name to camelCase. Note2: It is also recommended that you transform both search string and value to lower case, so your search becomes case insensitive, and trim them.

23 Aug
2 years ago

brunowerneck started a new conversation Windows + Homestead + Webpack Not Working Properly

Okay, here's my environment:

  1. A computer running Windows 10 1.1 A Homestead Virtual Machine installed with VirtualBox on the Windows 10 computer 1.2 A fresh install o Laravel 5.3.0-RC1 1.3 elixir-browsersync installed proxying to myproject.dev

The issue: When I ssh into the homestead vm and run npm run dev from Homestead, it does work and start watching files. I leave the ssh window opened and come back to my Windows machine and start PHPStorm to develop the new project. I try to access http://myproject.dev:3000 and browserSync sends any changes. When PHPStorm saves the files (it saves files automatically), webpack don't detect the changes and won't process them. I have to open a second console window, ssh into homestead and run gulp webpack manually to process the changes.

Using the same Homestead vm, however now on the Windows machine, if I run npm run dev from the Windows machine and I change any file in PHPStorm, then webpack works and and processes the changes. However, since I am running gulp watch from the Windows machine, browsersync won't proxy the address and the project only works by accessing http://localhost:3000

The problem: I work on multiple projects simultaneously and I must access them by their proxy address. If I run via Windows, I can only work on one project at any time because it will only proxy to localhost.

Supposedly, when any file is saved in the Windows machine, virtualbox tools do send the file to Homestead via shared folders, but webpack doesn't detect that those files have been changed and won't process them.

The solution (which I don't have): Having webpack process changes in Homestead vm when I save the files in PHPStorm running on my Windows machine, so browersync can proxy the projects to the correct addresses.

Does any one have any ideas? Thanks in advance.

09 Aug
2 years ago

brunowerneck left a reply on Laravel 5.3

My bad, sorry, you can also create a project using composer:

composer create-project laravel/laravel project dev-develop
21 Jul
2 years ago

brunowerneck left a reply on Laravel 5.3

Github contains only the released branches for Laravel. For the dev branches, you go to packagist.

https://packagist.org/packages/laravel/framework