pedroroccon

pedroroccon

Lead Developer at BYUS Technology

Member Since 4 Years Ago

Rio Claro

Experience Points
28,080
Total
Experience

1,920 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
213
Lessons
Completed
Best Reply Awards
1
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

Level 6
28,080 XP
Mar
26
1 week ago
Activity icon

Replied to SQLSTATE[23000]: Integrity Constraint Violation: 1048 Column 'name' Cannot Be Null

Also try to check if "name" is on your $fillable variable (If you are using it).

class User extends Model
{
    protected $fillable = ['name', 'email'];
}
Activity icon

Replied to API And Route Model Binding

@bugsysha All right! I'll try to replicate that in a new Laravel installation, and then I'll give a feedback here! Thanks! :D

Mar
23
2 weeks ago
Activity icon

Replied to API And Route Model Binding

@bugsysha I didn't change anything... It's just a simple API request, but I want to use the same controller for my frontend and API calls. But unfortaly, when I remove the web middleware, the Route Model Binding forcing me to add a User::findOrFail() on every controller that I want to return the user. Should I separate the Api Controller from my Web controller?

Mar
20
2 weeks ago
Activity icon

Replied to API And Route Model Binding

Hello @bugsysha

Yes, I know that. But doing this, my Route Model Binding stops working, wich means that I always need put a User::findOrFail($user) to fetch my model. The Route Model Binding only works if I have the web middleware setted, and I'm using the same controller for web and API.

Activity icon

Started a new Conversation API And Route Model Binding

Hello everyone!

I'm developing a very simple users API (Create, Read, Update, Delete). I already have my controllers setup and currently I'm using Isomnia to make my requests, but now i'm facing a problem.

In my routes/api.php file I added a "web" middleware, wich implements the CSRF Token. When I try to do a PATCH in Insomnia, the application throwns an execption with message "CSRF token mismatch".

I know that if I remove the "web" middleware i can solve this problem, but if I do that I can't use Route Model Binding.

Here is my routes file

Route::group(['prefix' => 'api', 'middleware' => ['web', 'auth:api']], function () {
    Route::resource('users', 'UserController');
});

Here is my UserController

public function update(UserRequest $request, User $user)
{
    $user->fill($request->except('password'));

    if ( ! empty($request->password)) {
        $user->password = bcrypt($request->password);
    }

    $user->update();

    if ($request->wantsJson()) {
        return $user->toJson();
    }
    
    return redirect($user->path());
}

Note: I'm using the same controller for API and my web application, make sense?

Anyone knows a solutions for that problem? Regards!

Dec
14
3 months ago
Activity icon

Awarded Best Reply on O.o I Have No Idea Reason Why

@paboo You need to make a "foreach" inside your tbody like this:

<tbody>
    @foreach($adc as $item)
        <tr>
            <th></th>
            <th>{{$item->id}}</th>
            <th>Email</th>
            <th>Age</th>
            <th>Marries</th>
            <th>Address</th>
            <th>Points</th>
            <th><button type="button" class="btn btn-danger">Remove</button>
            <button type="button" class="btn btn-primary">Edit</button></th>
        </tr>
    @endforeach
</tbody>
Dec
04
4 months ago
Activity icon

Replied to Disable Global Query Scope On Specific Controller

@snapey and @srinathdudi Thanks for the reply!

I liked the two solutions, but I liked the @srinathdudi solution. Simply adds a protected variable in the controllers that needs to disable the global query scope.

Thank you! Regards!

Dec
03
4 months ago
Activity icon

Started a new Conversation Disable Global Query Scope On Specific Controller

Greetings,

I created a global query scope in one of my models. The scope is called "waiting", and it is used to indicate that a follow resource is waiting to be approved.

    protected static function boot()
    {
        static::addGlobalScope('waiting', function(Builder $builder) {
            $builder->where('waiting', false);
        });
    }

I separated the approved resources in one specific view wich is associated to a controller. Then I created another controller wich will display all the "waiting" resources.

I know that I can disable the global scope temporarily, but there's a way to disable the global query scope in all methods of my controller. Later I'll need to implement more methods?

Regards!

Nov
08
4 months ago
Activity icon

Replied to Dealing With Git - Main Package And Subpackages

@aurawindsurfing Hmm, nice idea. I'll give it a try. I thought that Git has some solution to do that.

Nov
07
5 months ago
Activity icon

Started a new Conversation Dealing With Git - Main Package And Subpackages

Greetings

I have a main package called "Core" which is a Laravel installation with some custom modifications. My "Core" package depends on a series of other packages that I made. For example: "core-products", "core-customers", "core-invoices", etc... I made that way to reuse those modules in another projects, like a modular application.

My problem with GitHub is: I need to handle my repositories inside the vendor/pedroroccon/core-... folder, and everytime I change something, I init, and commit each package individually

Theres a way to commit my main "Core" project and the Git commits my dependencies too? Maybe with submodules?

Regards,

Oct
17
5 months ago
Activity icon

Replied to Laravel With PostCSS And Laravel Mix

@siangboon OMG I haven't saw that. Thank you very much!

Regards!

Oct
16
5 months ago
Activity icon

Started a new Conversation Laravel With PostCSS And Laravel Mix

Greetings!

Anyone knows how to use PostCSS in a standard Laravel installation? I'm using Laravel Mix. Here is my webpack.mix.js file:

const mix = require('laravel-mix');

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css').options({
        processCssUrls: false 
    })
    .copyDirectory('resources/images', 'public/images')
    .copyDirectory('resources/fonts', 'public/fonts')
    .browserSync('localhost:8000');

Regards!