Foks

Developer & owner at XevoTech

Member Since 10 Months Ago

Roskilde

Experience Points
12,730
Total
Experience

2,270 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
94
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.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 3
12,730 XP
Apr
11
2 days ago
Apr
09
4 days ago
Activity icon

Started a new Conversation Laravel Sail's NPM Uses Windows Path?

So I recently switched my development environment from Laragon to Laravel Sail, and I got it working today. However, when I run the command sail npm run dev it fails, and from the logs, I can see that it's due to Sail using the windows version of NodeJS.

[email protected]:~/lectero$ sail npm run dev

> dev
> npm run development


> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js

node:internal/modules/cjs/loader:927
  throw err;
  ^

Error: Cannot find module 'which-module'
Require stack:
- /var/www/html/node_modules/yargs/build/lib/command.js
- /var/www/html/node_modules/yargs/build/lib/yargs.js
- /var/www/html/node_modules/yargs/yargs.js
- /var/www/html/node_modules/yargs/index.js
- /var/www/html/node_modules/webpack-cli/bin/cli.js
- /var/www/html/node_modules/webpack/bin/webpack.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (/var/www/html/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> (/var/www/html/node_modules/yargs/build/lib/command.js:12:21)
    at Module._compile (/var/www/html/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/www/html/node_modules/yargs/build/lib/command.js',
    '/var/www/html/node_modules/yargs/build/lib/yargs.js',
    '/var/www/html/node_modules/yargs/yargs.js',
    '/var/www/html/node_modules/yargs/index.js',
    '/var/www/html/node_modules/webpack-cli/bin/cli.js',
    '/var/www/html/node_modules/webpack/bin/webpack.js'
  ]
}
ERROR: 1

How can I fix it?

Activity icon

Awarded Best Reply on Laravel Sail / Docker Is Slow

So I found out that it was the "bridge" that WSL2 uses to link Ubuntu. So what I ended up doing was moving the project into /home/<user>/<projectname> and then chmod the directory, and then Laravel Sail has fast responses.

Activity icon

Replied to Laravel Sail / Docker Is Slow

So I found out that it was the "bridge" that WSL2 uses to link Ubuntu. So what I ended up doing was moving the project into /home/<user>/<projectname> and then chmod the directory, and then Laravel Sail has fast responses.

Activity icon

Replied to Laravel Sail / Docker Is Slow

I haven't.

Apr
08
5 days ago
Activity icon

Replied to Laravel Sail / Docker Is Slow

@neilstee

Then I guess it's okay that it is slow? As long as it works and you know that the cause of slowness is your machine? Or the slowness is causing an issue on the Horizon part?

I haven't seen any issues with Horizon due to the slowness. (It's just annoying that it is slow)

I'll try with a fresh Laravel & Horizon install and report back.

Apr
07
6 days ago
Activity icon

Replied to Laravel Sail / Docker Is Slow

Also, have you tried installing WSL2? I see some threads that recommend using it for running Sail although I'm not familiar with it since I'm using Mac

@neilstee I'm running WSL2. It's an existing project that I'm trying to run with Sail.

I don't need it badly, but I'd prefer to make sure that everything works with Horizon before I deploy the new update.

Activity icon

Replied to Laravel Sail / Docker Is Slow

@neilstee I used Laragon before switching to Laravel Sail. My reason for switching is that I need to run horizon, as it's used in my production environment.

Activity icon

Replied to Laravel Sail / Docker Is Slow

@neilstee

I want to emulate my production environment, where I use Horizon. That's why I'd like to use Docker.

My laptop, which I'm currently on has 8Gb ram, and a 300GB SSD? Personally, I would like the laptop to have more ram.

Apr
06
1 week ago
Activity icon

Started a new Conversation Laravel Sail / Docker Is Slow

Hi!

I'm in the middle of changing my dev environment from Laragon to Laravel Sail.

However, when accessing 127.0.0.1 it takes a good time for the browser to even respond with some data.

Any ideas that could improve the response time?

Apr
02
1 week ago
Activity icon

Replied to Nova Graph Library

Okay, thank you

Activity icon

Started a new Conversation Nova Graph Library

What graph library does Nova use, is it open source? If not, can you recommend any alternatives?

Apr
01
1 week ago
Activity icon

Replied to Difference Between Forge And Envoyer?

Thank you for the reply @drehimself

Is there any good/quick guide on the usage of Forge and Envoyer together?

Activity icon

Started a new Conversation Difference Between Forge And Envoyer?

Hi!

I'm about to deploy my laravel app, and I'm wondering what I should use, Laravel Forge or Laravel Envoyer.

I would gladly take differences and similarities.

Best Regards

Mar
23
3 weeks ago
Activity icon

Replied to Searchable Select Input

Hmm, seems cool. But I'm currently interested in spending money on it, as I'm trying to learn as much of Livewire and AlpineJS as possible.

Activity icon

Replied to Searchable Select Input

@corvs There are some cases where I'd like it to be initially, but others where when the user actually enters something.

Activity icon

Replied to Searchable Select Input

@corvs I need to fetch data from the server, upon loading, as the select is requiring data from the server.

Do you have any other recommendations?

Activity icon

Replied to Searchable Select Input

I don't like the way it's made, I'd prefer a Livewire component instead.

Activity icon

Replied to Searchable Select Input

More like Select2, if you know it

Activity icon

Started a new Conversation Searchable Select Input

I'm currently working on an app that requires a searchable input, like where I can search states for a country in a form.

How would I go about it?

Mar
15
4 weeks ago
Activity icon

Replied to Storage Of QuillJS Content

Found out that it was missing an input event...

element.dispatchEvent(new Event('input'));
Activity icon

Replied to Storage Of QuillJS Content

Elarporate on the different approach?

Activity icon

Replied to Storage Of QuillJS Content

@snapey I've used the example you gave me, but for some reason whenever I submit the form, the hidden input's value is null? Any idea on how to fix that?

Activity icon

Replied to Storage Of QuillJS Content

Worked :)

Mar
14
4 weeks ago
Activity icon

Replied to Storage Of QuillJS Content

@snapey You don't happen to know how I can prevent the editor to disappear when I use form validation from Livewire?

Activity icon

Replied to Storage Of QuillJS Content

How did you store it in the database? Like what collumn type?

Activity icon

Started a new Conversation Storage Of QuillJS Content

Hi! I'm currently working on adding QuillJS to a project, and I'm currently stuck with how I should store QuillJS's content for later rendering?

Any thoughts/ideas?

Thanks in advance!

Feb
03
2 months ago
Activity icon

Replied to General Error: 1364 Field 'name' Doesn't Have A Default Value

It seems like it doesn't matter

Activity icon

Replied to General Error: 1364 Field 'name' Doesn't Have A Default Value

Fixed it. Thank you so much. What does the strict value even do?

Activity icon

Replied to General Error: 1364 Field 'name' Doesn't Have A Default Value

I've just checked, even tho I remove the paratheses it doesn't fix it. None of my factories uses the User Model other than the UserFactory

Activity icon

Started a new Conversation General Error: 1364 Field 'name' Doesn't Have A Default Value

Hi!

I'm currently sitting with an odd issue.

When I try to run $user = App\Models\User::factory()->create(); in Tinker, it giving me this error

Illuminate\Database\QueryException with message 'SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value (SQL: insert into users (updated_at, created_at) values (2021-02-03 08:19:29, 2021-02-03 08:19:29)

However, it shouldn't as the factory does have a value for the name:

<?php

namespace Database\Factories;

use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

class UserFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = User::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        return [
            'name' => $this->faker->name(),
            'email' => $this->faker->unique()->safeEmail,
            'password' => 'yIXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
        ];
    }
}

And the name field is specified in my $fillables array:

<?php

namespace App\Models;

use App\Models\Academic;
use App\Traits\HasRoles;
use Database\Factories\UserFactory;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Traits\Notifiable;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;

class User extends Authenticatable
{
    use Notifiable, HasFactory, HasRoles;

    protected static $databaseNotificationClass = DatabaseNotification::class;

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

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

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

    /**
     * Returns the user's academic
     *
     * @return HasOne
     */
    public function academic(): HasOne
    {
        return $this->hasOne(Academic::class);
    }
}

I run on PHP 7.4 & Laravel 8.

I've tried the following:

  • Running composer dump-autoload -o
  • Restarted tinker
  • Made sure that my name is in $fillable
  • Running dump(new User()) which returned https://i.imgur.com/4peAxE9.png

I've posted this earlier today: https://laracasts.com/discuss/channels/laravel/general-error-1364-field-name-doesnt-have-a-default-value-1 Reposted as I marked a comment as "best answer" by a mistake.

Activity icon

Replied to General Error: 1364 Field 'name' Doesn't Have A Default Value

That wasn't the problem, anyways thanks for reminding

Activity icon

Started a new Conversation General Error: 1364 Field 'name' Doesn't Have A Default Value

Hi!

I'm currently sitting with an odd issue.

When I try to run $user = App\Models\User::factory()->create(); in Tinker, it giving me this error

Illuminate\Database\QueryException with message 'SQLSTATE[HY000]: General error: 1364 Field 'name' doesn't have a default value (SQL: insert into users (updated_at, created_at) values (2021-02-03 08:19:29, 2021-02-03 08:19:29)

However, it shouldn't as the factory does have a value for the name:

<?php

namespace Database\Factories;

use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

class UserFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = User::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        return [
            'name' => $this->faker->name,
            'email' => $this->faker->unique()->safeEmail,
            'email_verified_at' => now(),
            'password' => 'yIXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
            'remember_token' => Str::random(10),
        ];
    }
}

And the name field is specified in my $fillables array:

<?php

namespace App\Models;

use App\Models\Academic;
use App\Traits\HasRoles;
use Database\Factories\UserFactory;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Traits\Notifiable;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;

class User extends Authenticatable
{
    use Notifiable, HasFactory, HasRoles;

    protected static $databaseNotificationClass = DatabaseNotification::class;

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

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

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

    /**
     * Returns the user's academic
     *
     * @return HasOne
     */
    public function academic(): HasOne
    {
        return $this->hasOne(Academic::class);
    }
}

I run on PHP 7.4 & Laravel 8

Jan
22
2 months ago
Activity icon

Replied to Tests Don't Recognize A Table, That Has Been Migrated

@sr57 I found the problem I think... Nothing to do with the migrations or tests. I followed this guide https://laracasts.com/series/whats-new-in-laravel-5-1/episodes/16 and apparently when I do this in my AuthServiceProvider

<?php

namespace App\Providers;

use App\Models\Homework;
use App\Models\Permission;
use App\Policies\HomeworkPolicy;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        Homework::class => HomeworkPolicy::class
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        foreach ($this->getPermissions() as $permission)
		{
			Gate::define($permission->name, function ($user) use ($permission) {
				return $user->hasRole($permission->roles);
			});
		}
    }

    protected function getPermissions()
	{
		return Permission::with('roles')->get();
	}
}

Activity icon

Replied to Tests Don't Recognize A Table, That Has Been Migrated

I haven't tried that, normally just use php artisan migrate:fresh --seed, When I try php artisan migrate:refresh it gives me an error about foreign key constraint violation

Activity icon

Replied to Tests Don't Recognize A Table, That Has Been Migrated

I have the RefreshDatabase Trait, and I'm using the Test\TestCase

Jan
21
2 months ago
Activity icon

Replied to Tests Don't Recognize A Table, That Has Been Migrated

When I migrate, the table is getting created in the db.

I can show the permission table:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePermissionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('permissions', function (Blueprint $table) {
			$table->id();
			$table->string('name');
			$table->string('label')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('permissions');
    }
}

Activity icon

Started a new Conversation Tests Don't Recognize A Table, That Has Been Migrated

Hello! I'm facing a rather weird problem with my test, which occurred after adding a migration.

When I try to run my tests I get the following error

 C:\laragon\www\lectero\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDO\Exception.php:18
      Doctrine\DBAL\Driver\PDO\Exception::("SQLSTATE[HY000]: General error: 1 no such table: permissions")

However, when I run php artisan migrate it migrates just fine, works just fine when I try it in Tinker.