knubbe

knubbe

Web Developer at KNUBBE CODING

Member Since 2 Years Ago

Experience Points
31,720
Total
Experience

3,280 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
294
Lessons
Completed
Best Reply Awards
0
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 7
31,720 XP
May
23
3 days ago
Activity icon

Awarded Best Reply on Can't Connect To Database With Db Client [08001]

I finally figure out. For homestead on linux you need to pass this credentials:

host: 192.168.10.10

instead of 127.0.0.1 or localhost

Activity icon

Replied to Can't Connect To Database With Db Client [08001]

I finally figure out. For homestead on linux you need to pass this credentials:

host: 192.168.10.10

instead of 127.0.0.1 or localhost

May
22
4 days ago
Activity icon

Replied to Can't Connect To Database With Db Client [08001]

Access denied for user 'homestead'@'localhost' (using password: YES)

Activity icon

Replied to Can't Connect To Database With Db Client [08001]

Public Key Retrieval is not allowed

Activity icon

Replied to Can't Connect To Database With Db Client [08001]

I am trying to setup a connection with DBeaver after I vagrant up. In vagrant I was not able to connect to mysql with root as user from command line. I can connect with mysql -u homestead - p where password is secret

Activity icon

Replied to Can't Connect To Database With Db Client [08001]

When I use ssh with credentials that you shere I got this: Access denied for user 'root'@'localhost' (using password: NO)

Activity icon

Replied to Can't Connect To Database With Db Client [08001]

why is your username root and port 3306 instead of 33060 and for ssh how you use vagrant for username and password

Activity icon

Replied to Can't Connect To Database With Db Client [08001]

I am using right credentials. On macOs I setup easily but I can't on linux ubuntu 20.04.

Activity icon

Started a new Conversation Can't Connect To Database With Db Client [08001]

I am using laravel homestead on linux and when I want to connect to database with phpstorm or DBeaver I receive:

[08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Index 5 out of bounds for length 5.

I investigate and find that problem could be with jdbc driver but all of my drivers are up to date. On homestead I use mysql 5.7 and both (phpstrom and DBeaver) are up to date.

May
01
3 weeks ago
Activity icon

Replied to How To Add A File To SerializeArray

It's empty with FormData

Activity icon

Started a new Conversation How To Add A File To SerializeArray

I have a wizard with different forms on every step. In one of the steps I have cropper for images and on next step I want to send crop data to controller method but I can't add that to serializeArray. This is my js part:

wizard.on('beforeNext', function (wizardObj) {
	wizardObj.stop();
        let wizardForm = $('#kt_form_' + wizardObj.currentStep)
        let dataForm = wizardForm.serializeArray()
        if (wizardObj.currentStep == 2) {
        	canvas = cropper.getCroppedCanvas({
                	width: 160,
                        height: 160,
                });
               canvas.toBlob(function (blob) {
                       url = URL.createObjectURL(blob);
                       var reader = new FileReader();
                       reader.readAsDataURL(blob);
                       reader.onloadend = function () {
                       		var base64data = reader.result;
                                dataForm.push({ name: "cropImage", value: base64data });
                            }
                       });
               }

              let url = wizardForm.attr('action')
              let method = wizardForm.attr('method')
              $.ajax({
                   url: url,
                   type: method,
                   data: dataForm,
              }).done(function (response) {
                    wizardObj.goNext();
              })

When I console log a dataForm I see that I have cropImage attribute but on controller method it's not part of request when I dd($request->all())

Apr
21
1 month ago
Activity icon

Replied to Laravel Forge Deployment Fail With Php 7.4 Typed Property On User Model

My IDE (storm) change vendor HasAttributes trait and set array type to all properties and because of that in local everything works fine. Delete vendor, composer install and return User model to default save my day ;)

Apr
19
1 month ago
Activity icon

Started a new Conversation Laravel Forge Deployment Fail With Php 7.4 Typed Property On User Model

I create fresh new project in Laravel 7 with php 7.4 and on User model I have this properties:

* The attributes that are mass assignable.
     *
     * @var array
     */
    protected array $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected array $hidden = [
        'password', 'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected array $casts = [
        'email_verified_at' => 'datetime',
    ];

and on Laravel Homestead everything works fine but when I want to deploy app with Laravel Forge on UserSeeder I got this message:

PHP Fatal error:  Type of App\User::$casts must not be defined (as in class Illuminate\Foundation\Auth\User)
Mar
07
2 months ago
Activity icon

Replied to Unique String Attribute With Special Character

I am using utf8 on mysql 5.7. Which one do I need?

Activity icon

Started a new Conversation Unique String Attribute With Special Character

I have a field registration in my migration file and it looks like this:

$table->string('registration')->unique();

but when I have similar, but not exactly the same one strings, it breaks. It looks like that the problem is with special char and this two strings are the same BG 863 ČŠ and BG 863 ČS but it should not be.

Feb
09
3 months ago
Activity icon

Started a new Conversation How To Get Latest Records Based On Two Foreign Id

I have a CenterService entity (table center_services) and there is two columns center_id and service_id.

I have an array of services ids and I need collection in return but without of duplication center_id and service_id. I only need last record of that combination.

This is how I try:

$requiredServices = Service::whereRequiredService(true)->pluck('id');

return CenterService::whereIn('service_id', $requiredServices)->latest()->get();

but it's just order that collection with all duplicate data.

Jan
09
4 months ago
Activity icon

Replied to Laravel Valet On Catalina OS

😂😂😂😂😂😂😂

Activity icon

Replied to Laravel Valet On Catalina OS

I move back to Mojave and setup all from scratch

Dec
27
4 months ago
Activity icon

Replied to Sort By Latest Record Column From Relations

still the same order as mine (wrong)

Activity icon

Replied to Sort By Latest Record Column From Relations

Column not found: 1054 Unknown column 'registrations.expiry_date' in 'order clause' (SQL: select * from vehicles order by registrations.expiry_date asc limit 5)

Activity icon

Replied to Sort By Latest Record Column From Relations

Column not found: 1054 Unknown column 'activeRegistration.expiry_date' in 'order clause'

Activity icon

Started a new Conversation Sort By Latest Record Column From Relations

I have two tables (models) Vehicle and Registration. Vehicle has many registrations and every registrations has start_date and expiry_date and I need to get all vehicles with last registration sort by expiry_date. This is mine Vehicle model part:

/**
  * @return HasMany
  */
  public function registrations() :HasMany
  {
      return $this->hasMany(Registration::class);
  }

    /**
     * @return HasOne
     */
    public function activeRegistration() :HasOne
    {
        return $this->hasOne(Registration::class)->latest();
    }

and I try to solve like this:

Vehicle::with('activeRegistration')->get()->sortBy('activeRegistration.expiry_date')->take(5) // I need only 5 records

but this is not working as I expected. This is part of mine blade file:

@foreach($registrationsVehicle as $vehicle)
    <tr>
        <td>{{ $vehicle->registration }}</td>
        <td>{{ $vehicle->vehicleBrand->name }}</td>
        <td>{{ $vehicle->model }}</td>
        <td>{{ optional($vehicle->activeRegistration)->start_date }}</td>
        <td>{{ optional($vehicle->activeRegistration)->expiry_date }}</td>
    </tr>
@endforeach

I get data but it's not order correctly. How to solve this?

Dec
04
5 months ago
Activity icon

Replied to Laravel Valet On Catalina OS

fresh install. I follow instructions from official documentation

Activity icon

Started a new Conversation Laravel Valet On Catalina OS

Does anyone have a problem with Valet on Catalina? I wasn't able to setup correctly because after install I wasn't able to ping

Dec
03
5 months ago
Activity icon

Started a new Conversation Laravel 6 And Php 7.4 Seeding Problem

I update to php 7.4 and in mine laravel 6 project when I seed a class I get this error:

ErrorException : implode(): Passing glue string after array is deprecated. Swap the parameters

This is my 'problematic' factory class:

$factory->define(Complaint::class, function (Faker $faker) {
    return [
        'date' => Carbon::parse($faker->dateTimeBetween('-5 years', 'now'))->format('d.m.Y'),
        'type_of_complaint_id' => TypeOfComplaint::inRandomOrder()->first()->id,
        'center_id' => Center::inRandomOrder()->first()->id,
        'complainant' => $faker->name,
        'description' => $faker->text(50),
        'created_by' => User::inRandomOrder()->first()->id,
        'updated_by' => User::inRandomOrder()->first()->id,
    ];
});

What could be a problem?

Nov
26
6 months ago
Activity icon

Replied to Eloquent With Morph And HasMany

OK but my question is how?

Nov
25
6 months ago
Activity icon

Started a new Conversation Eloquent With Morph And HasMany

I have 3 entities (Center, Building and Room) and all 3 has method:

/**
 * @return MorphMany
 */
 public function damages() :MorphMany
 {
     return $this->morphMany(Damage::class, 'damageable');
 }

Also Center hasMany Building, Building hasMany Room and Center hasManyThrough Room.

How to write query to get all damages by center included all damages from building that belong to center and all damages from room that belong to center?