Foks

Developer & owner at XevoTech

Member Since 9 Months Ago

Roskilde

Experience Points
11,280
Total
Experience

3,720 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
85
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
11,280 XP
Feb
03
3 weeks 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
1 month 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
1 month 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.

Jan
13
1 month ago
Activity icon

Started a new Conversation Sticky Footer Using Tailwindcss

Hello! I'm trying to make a sticky footer with tailwindcss.

I've written the following code

        <div class="w-full">
            <div class="flex flex-col h-full">
                <div class="h-10 p-2 shadow-md flex items-center ">
                    Chat title
                </div>
                <div class="flex-1 mx-auto p-8">
                    kkkk
                </div>
                <div class="w-full text-center border-t border-grey p-4 pin-b">

                he.ll

                </div>
            </div>
        </div>

However, the div disappears.

Dec
28
2 months ago
Activity icon

Replied to PermissionFactory Not Found

I feel so stupid for forgetting to run compser dump-autoload

Activity icon

Started a new Conversation PermissionFactory Not Found

Hello!

I created a model called Permissions, and when I noticed the typo, I renamed both the Permissons.php & the class, as well as the factory I had created for that model, but now when I run my tests, I get an error saying that PermissionFactory was not found. Any ideas on how I can solve this issue?

App\Models\Permission

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Permission extends Model
{
    use HasFactory;
    public $timestamps = false;

    public function role()
    {
        return $this->belongsTo(Role::class);
    }
}

Database\Factories

<?php

namespace Database\Factories;

use App\Models\Permission;
use Illuminate\Database\Eloquent\Factories\Factory;

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

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        return [
            'permission' => $this->faker->name(),
            'value' => 1,
            'role_id' => Role::factory()
        ];
    }
}

The test methods, that fails is: testRoleCanHavePermission & testAccessPermissionRelationshipThroughUser

Test\Feature\Roles

<?php

namespace Tests\Feature\Roles;

use App\Models\Permission;
use App\Models\Role;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Support\Facades\Schema;
use Tests\TestCase;

class UserRolesTest extends TestCase
{
    use RefreshDatabase;

    /**
     * Tests that a user can have roles
     *
     * @return void
     */
    public function testUserCanHaveRoles()
    {
        $user = User::factory()->hasAttached(Role::factory()->count(2))->create();
        $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $user->roles);
        $this->assertCount(2, $user->roles);
    }


    /**
     * Tests that a role can have permissions
     *
     * @returns void
     */
    public function testRoleCanHavePermission()
    {
        $role = Role::factory()->has(Permission::factory()->count(2))->create();
        $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $role->permissions);
        $this->assertCount(2, $role->permissions);
    }

    /**
     * Tests that we can access the permissions of the role through the user
     *
     * returns void
     */
    public function testAccessPermissionRelationshipThroughUser()
    {
        $user = User::factory()->hasAttached(Role::factory()->has(Permission::factory()->count(2))->count(2))->create();
        $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $user->roles);
        $this->assertCount(2, $user->roles);

        foreach ($user->roles as $role) {
            $this->assertInstanceOf('Illuminate\Database\Eloquent\Collection', $role->permissions);
            $this->assertCount(2, $role->permissions);
        }
    }

    /**
     * Tests that the migrations migrate the expected columns of the table 'roles'
     *
     * returns void
     */
    public function testRoleTableHasExpectedColumns()
    {
        $this->assertTrue(
            Schema::hasColumns('roles', [
                'id','name'
            ]), 1);
    }

    /**
     * Tests that the migrations migrate the expected columns of the table 'role_users'
     *
     * returns void
     */
    public function testRoleUserTableHasExpectedColumns()
    {
        $this->assertTrue(
            Schema::hasColumns('role_user', [
                'id','user_id', 'role_id'
            ]), 1);
    }

    /**
     * Tests that the migrations migrate the expected columns of the table 'permissions'
     *
     * returns void
     */
    public function testPermissionsTableHasExpectedColumns()
    {
        $this->assertTrue(
            Schema::hasColumns('permissions', [
                'id','permission', 'role_id', 'value'
            ]), 1);
    }
}
Dec
27
2 months ago
Activity icon

Replied to Adding Settings

Any ideas?

Dec
25
2 months ago
Activity icon

Started a new Conversation Adding Settings

Hello!

I'd like to hear what you think would be the best approach to implement Settings in a multi-tenant app. What I could find on this post, https://laracasts.com/discuss/channels/laravel/settings, but didn't feel that it provided me with the best solution.

In that post, the package called "Laravel Settings" (https://github.com/RaggiTech/laravel-settings) is getting linked, and to me, it seems like a viable option, however, there are some things that I'm uncertain about.

Like will a tenant, which has some children tenants, be able to choose a setting, where it does affect its children, but not the other tenant's children?

Also, if you think of another & easier way than using that package, I'll be happy to hear them.

Best Regards, Merry Christmas & happy new year.

Dec
09
2 months ago
Dec
08
2 months ago
Activity icon

Replied to Collect Data From Socalite And The User

Hmm it doesn't seem to be what I'm on about https://i.imgur.com/7TzgTKy.gif

Dec
07
2 months ago
Activity icon

Started a new Conversation Collect Data From Socalite And The User

Hello! How I can get the user to provide more data, than what I receive from Socialite, and validate it without it throwing an InvalidStateException?

Current code:

routes/auth.php

<?php

use App\Http\Controllers\Auth\AuthenticatedSessionController;
use App\Http\Controllers\Auth\ConfirmablePasswordController;
use App\Http\Controllers\Auth\EmailVerificationNotificationController;
use App\Http\Controllers\Auth\EmailVerificationPromptController;
use App\Http\Controllers\Auth\NewPasswordController;
use App\Http\Controllers\Auth\PasswordResetLinkController;
use App\Http\Controllers\Auth\RegisteredUserController;
use App\Http\Controllers\Auth\VerifyEmailController;
use Illuminate\Support\Facades\Route;

Route::get('/login', [AuthenticatedSessionController::class, 'create'])
                ->middleware('guest')
                ->name('login');

Route::get('/oauth/discord', [AuthenticatedSessionController::class, 'redirectToProvider'])
                ->middleware('guest')
                ->name('auth');

Route::get('/oauth/discord/callback', [AuthenticatedSessionController::class, 'handleProviderCallback'])
    ->middleware('guest')
    ->name('auth.discord.callback');

Route::post('/oauth/details', [AuthenticatedSessionController::class, 'handleDetails'])
    ->middleware('guest')
    ->name('auth.details');

Route::post('/logout', [AuthenticatedSessionController::class, 'destroy'])
                ->name('logout')
                ->middleware('auth');

app/Http/Controllers/Auth

<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Laravel\Socialite\Facades\Socialite;
use Symfony\Component\HttpFoundation\RedirectResponse;

class AuthenticatedSessionController extends Controller
{
    /**
     * Display the login view.
     *
     * @return Application|Factory|View
     */
    public function create()
    {
        return view('auth.login');
    }

    /**
     * Handle an incoming authentication request.
     *
     * @param  \App\Http\Requests\Auth\LoginRequest  $request
     * @return \Illuminate\Http\RedirectResponse
     */
    public function store(LoginRequest $request)
    {
        $request->authenticate();

        $request->session()->regenerate();

        return redirect(RouteServiceProvider::HOME);
    }

    /**
     * Destroy an authenticated session.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\RedirectResponse
     */
    public function destroy(Request $request)
    {
        Auth::logout();

        $request->session()->invalidate();

        $request->session()->regenerateToken();

        return redirect('/');
    }

    /**
     * Redirect the user to the Discord authentication page.
     *
     * @return RedirectResponse
     */
    public function redirectToProvider()
    {
        return Socialite::driver('discord')->redirect();
    }

    /**
     * Obtain the user information from Discord.
     *
     * @return Application|Factory|View|Response
     */
    public function handleProviderCallback()
    {
        $data = Socialite::driver('discord')->user();
        return view('auth.details', [
            'data' => $data
        ]);
    }

    public function handleDetails(Request $request)
    {
        // Honeypot
        if(microtime(true) - $request->csfr_timestamp < 2 || $request->csfr_checksum != '')
        {
            abort(422,'Spam Detected');
        }

        $data = $request->validate([
            'email' => 'required|email|unique:users,email',
            'name' => 'required|string|min:2'
        ]);
    }
}

If the name field is less than 2 characters, it throws an InvalidStateException

Dec
01
2 months ago
Activity icon

Awarded Best Reply on Laravel Livewire Indexes Random Keys To Array

Solved it by using wire:click instead of wire:model

Activity icon

Replied to Laravel Livewire Indexes Random Keys To Array

Solved it by using wire:click instead of wire:model

Activity icon

Replied to Laravel Livewire Indexes Random Keys To Array

So you say that I've to make a new variable for each notification? Or is it the attribute name that we talk about?

Activity icon

Replied to Laravel Livewire Indexes Random Keys To Array

So I have got a UI table where I would like to add a mass action, where you have a select box and can do an action fx: "Mark as read"

But when I try to index the Notification's UUID, from $this->massSelect, but Livewire throws an error saying "Undefined Offset: 0"

Nov
30
2 months ago
Activity icon

Awarded Best Reply on PHPStorm Marking Closure As An Error

Just updated PHPStorm to 2020.4, which fixed it

Activity icon

Replied to PHPStorm Marking Closure As An Error

Just updated PHPStorm to 2020.4, which fixed it

Activity icon

Started a new Conversation Laravel Livewire Indexes Random Keys To Array

Hello! I'm currently having a problem with a Laravel Livewire component. So I'm trying to add a "mass action" to my notification page. But Livewire will try to index either 0or " " to the array, and not the UUID that the notifications have.

app/Http/Livewire/NotificationPage.php

<?php

namespace App\Http\Livewire;

use App\Notifications\Test;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Notification;
use Livewire\Component;
use Livewire\WithPagination;

class NotificationPage extends Component
{
    use WithPagination;

    public $unread = false;
    public $massSelect = [];
    public $select = '';

    public function mount()
    {
        foreach (Auth::user()->notifications as $notification)
        {
            $this->massSelect[$notification->id] = false;
        }
    }

    public function render()
    {
        //Auth::user()->notify(new Test('test', '#'));
        $notifications = $this->unread == false ? Auth::user()->notifications()->paginate(25) : Auth::user()->unreadNotifications()->paginate(25);
        return view('livewire.notification-page', [
            'notifications' => $notifications
        ]);
    }

    public function updatedSelect($val)
    {
        //dump($val, $this->select);
        if($this->massSelect[$this->select] == false)
        {
            $this->massSelect[$this->select] = true;
        } else {
            $this->massSelect[$this->select] = false;
        }
        //$this->select = '';

        //if($this->massSelect[0] == 'a2fb3353')
        //{
        //    Arr::forget($this->massSelect, 0);
        //}
        //array_push($this->massSelect, $notification);
        //$this->select = '';
        //$this->resetPage();
        //dd($this->massSelect);

    }

    public function updatedMassSelect($value)
    {
        dd('er');
    }

    public function status()
    {
        $this->unread = !$this->unread;
        $this->resetPage();
    }
}

resources/views/livewire/notification-page.blade.php

<div>
    <div class="inline-flex">
        <button type="button" wire:click="status" class="@if($unread == false) bg-gray-400 @else bg-gray-300 @endif focus:outline-none hover:bg-gray-500 text-gray-800 font-bold py-2 px-4 rounded-l">
            @lang('notifications.all')
        </button>
        <button type="button" wire:click="status"  class="@if($unread == true) bg-gray-400 @else bg-gray-300 @endif focus:outline-none hover:bg-gray-500 text-gray-800 font-bold py-2 px-4 rounded-r">
            @lang('notifications.unread')
        </button>
    </div>

    <div class="flex flex-col mt-2">
        <div class=" overflow-x-auto">
            <div class="py-2 align-middle inline-block min-w-full">
                <div class="shadow overflow-hidden border-b border-gray-200 sm:rounded-lg">
                    <table class="min-w-full divide-y divide-gray-200">
                        <thead>
                            <tr>
                                <th class="px-6 py-3 bg-gray-300 text-left text-xs leading-4 font-medium text-gray-700 uppercase tracking-wider">
                                </th>
                                <th class="px-6 py-3 bg-gray-300 text-left text-xs leading-4 font-medium text-gray-700 uppercase tracking-wider">
                                    Titel
                                </th>
                                <th class="px-6 py-3 bg-gray-300 text-left text-xs leading-4 font-medium text-gray-700 uppercase tracking-wider">
                                    Title
                                </th>
                                <th class="px-6 py-3 bg-gray-300 text-left text-xs leading-4 font-medium text-gray-700 uppercase tracking-wider">
                                    Status
                                </th>
                                <th class="px-6 py-3 bg-gray-300"></th>
                            </tr>
                        </thead>
                        <tbody class="bg-white divide-y divide-gray-200">
                            @forelse($notifications as $notification)
                                <tr>
                                    <td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500">
                                        <input id="{{ $notification->id }}" name="mass-action-check" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded checked:bg-blue-600 checked:border-transparent" value="{{ $notification->id }}" wire:model="select"
                                            @if($massSelect[$notification->id] == true)
                                                checked
                                            @else

                                            @endif
                                        >
                                        @dump($massSelect[$notification->id], $notification->id)
                                    </td>
                                    <td class="px-6 py-4 whitespace-no-wrap">
                                        <div class="flex items-center">
                                            <div class="ml-4">
                                                <div class="text-sm leading-5 font-medium text-gray-900">
                                                    {{ $notification->data['title'] }}
                                                </div>
                                                <!--<div class="text-sm leading-5 text-gray-500">
                                                    [email protected]
                                                </div>-->
                                            </div>
                                        </div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-no-wrap">
                                        <div class="text-sm leading-5 text-gray-900">Category</div>
                                        <div class="text-sm leading-5 text-gray-500">Optimization</div>
                                    </td>
                                    <td class="px-6 py-4 whitespace-no-wrap">
                                        <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-200 text-green-800">
                                          Active
                                        </span>
                                    </td>
                                    <td class="px-6 py-4 whitespace-no-wrap text-right text-sm leading-5 font-medium">
                                        <a href="#" class="text-indigo-600 hover:text-indigo-900">L├Žst</a>
                                    </td>
                                </tr>
                            @empty
                                <tr>
                                    <td class="px-6 py-4 whitespace-no-wrap" colspan="5">
                                        <div class="flex items-center">
                                            <div>
                                                <div class="text-sm leading-5 font-medium text-gray-900">
                                                    Du har ingen notifikationer!
                                                </div>
                                                <!--<div class="text-sm leading-5 text-gray-500">
                                                    [email protected]
                                                </div>-->
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            @endforelse
                        </tbody>
                    </table>
                    @dump($massSelect)
                </div>
            </div>
            {{ $notifications->links() }}
        </div>
    </div>
</div>

Nov
24
3 months ago
Nov
19
3 months ago
Activity icon

Replied to PHPStorm Marking Closure As An Error

I use PHPStorm 2020.2, and there are no updates available

Nov
18
3 months ago
Activity icon

Replied to PHPStorm Marking Closure As An Error

@sinnbeck Didn't seem to work. However, when I set the PHP interpreter is getting set to PHP7.2, but I have PHP7.4 installed, could this be the reason?

Nov
16
3 months ago
Activity icon

Replied to PHPStorm Marking Closure As An Error

@sinnbeck Here is a picture of how it looks like https://i.imgur.com/8XQMdxX.png

Activity icon

Replied to PHPStorm Marking Closure As An Error

@tippin The fun thing is that it isn't happening on my laptop, only on my pc at home. As I said to Sinnbeck, I'll check once I get home ;)

Activity icon

Replied to PHPStorm Marking Closure As An Error

I'm only experiencing this om my stationary computer at home, so once I get home, I will check and reply back

Activity icon

Replied to PHPStorm Marking Closure As An Error

@tippin I'm pretty sure that my interpreter is set, where is that I check that? The thing about the Modules folder is that It's a custom thing that I'm working on, and I'm using Laravel Modules for that. https://github.com/nWidart/laravel-modules

Nov
15
3 months ago
Activity icon

Replied to PHPStorm Marking Closure As An Error

It does say that the Closure isn't defined.

If you hover over the squigglies on the top of bottom of the docblock /** what does it say?

Not sure what you mean by that?

I'm pretty sure that I've set the path for php.exe in the settings

Activity icon

Replied to PHPStorm Marking Closure As An Error

@tippin I've done everything that you said, however, Closure is still marked as an error.

And the helpers are also still underlined.

Any other ideas?

Nov
14
3 months ago
Activity icon

Started a new Conversation PHPStorm Marking Closure As An Error

Hello! I'm having a slight problem with my PHPStorm, it is marking Closure as "invalid"...

The code where I'm experiencing the issue

<?php

namespace Modules\Fortify\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;

class FortifyAccess
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle(Request $request, Closure $next)
    {
        if(Auth::user()->hasPermission('view_fortify')) return $next($request);
        abort(401);

    }
}

Picture of what my problem https://i.imgur.com/J6fjs3M.png