Foks

Foks

Developer & owner at XevoTech

Member Since 4 Months Ago

Roskilde

Experience Points
1,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
10
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 1
1,720 XP
Sep
22
2 days ago
Activity icon

Replied to Method Illuminate\Database\Eloquent\Collection::links Does Not Exist.

Just gives me the following error;

Method Illuminate\Database\Eloquent\Collection::paginate does not exist. (View: C:\laragon\www\accounting\resources\views\accounting.blade.php)
Activity icon

Started a new Conversation Method Illuminate\Database\Eloquent\Collection::links Does Not Exist.

Hi! I'm currently working on a accounting software, and I'm facing a problem with the Laravel 8 Paginator.

This is the error I'm getting

Method Illuminate\Database\Eloquent\Collection::links does not exist. (View: C:\laragon\www\accounting\resources\views\livewire\accounting-dashboard.blade.php) (View: C:\laragon\www\accounting\resources\views\livewire\accounting-dashboard.blade.php)

This is my accounting-dashboard.blade.php

<div>

    <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">

        @dump(App\Models\Account::find(1)->transactions)

        <div class="flex flex-col">
            <div class="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
                <div class="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8">
                    <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-50 text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider">
                                    Name
                                </th>
                                <th class="px-6 py-3 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider">
                                    Title
                                </th>
                                <th class="px-6 py-3 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider">
                                    Status
                                </th>
                                <th class="px-6 py-3 bg-gray-50 text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider">
                                    Role
                                </th>
                                <th class="px-6 py-3 bg-gray-50"></th>
                            </tr>
                            </thead>
                            <tbody class="bg-white divide-y divide-gray-200">

                                @foreach($transactions as $transaction)
                                    <tr>
                                        <td class="px-6 py-4 whitespace-no-wrap">
                                            <div class="flex items-center">
                                                <div class="flex-shrink-0 h-10 w-10">
                                                    <img class="h-10 w-10 rounded-full" src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&amp;ixid=eyJhcHBfaWQiOjEyMDd9&amp;auto=format&amp;fit=facearea&amp;facepad=4&amp;w=256&amp;h=256&amp;q=60" alt="">
                                                </div>
                                                <div class="ml-4">
                                                    <div class="text-sm leading-5 font-medium text-gray-900">
                                                        Jane Cooper
                                                    </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">Regional Paradigm Technician</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-100 text-green-800">
                                              Active
                                            </span>
                                        </td>
                                        <td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500">
                                            Admin
                                        </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">Edit</a>
                                        </td>
                                    </tr>
                                @endforeach

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

    {{ $transactions->links() }}

</div>

This is my AccountingDashboard.php, which belongs to the .blade file above.

<?php

namespace App\Http\Livewire;

use App\Models\Transaction;
use Livewire\Component;

class AccountingDashboard extends Component
{
    public $transactions = [];

    public function mount()
    {
        $this->transactions = Transaction::all();
    }

    public function render()
    {
        $transaction = Transaction::where('id', '!=', 'aa')->get()->paginate(1);
        return view('livewire.accounting-dashboard', [
            'transactions' => $transaction
        ]);
    }
}

Thanks in advance & Best Regards Foks

Sep
21
3 days ago
Activity icon

Replied to Laravel Package Development & Jobs

Nevermind, found out

Activity icon

Replied to Laravel Package Development & Jobs

Just to be sure, what is it that the app() method does?

Activity icon

Replied to Is Ui Removed In Laravel 8

Can Fortify be used with old applications that used UI?

Activity icon

Started a new Conversation Laravel Package Development & Jobs

Hi!

I'm currently writing a package for Laravel, and I need to run a job in this package, but I'm not quite sure how I can do so, any ideas? I used this https://laravelpackageboilerplate.com/#/ boilerplate maker to create boilerplate for it.

Thanks in advance & Best regards Foks

Sep
16
1 week ago
Activity icon

Replied to Laravel 8 Factories & Pivot Table

I see... Thanks.

Activity icon

Started a new Conversation Laravel 8 Factories & Pivot Table

Hello, How can I seed a pivot table with a factory?

I'm using the table example listed under https://laravel.com/docs/8.x/eloquent-relationships#many-to-many

How can I then seed the roles_user table with a factory?

Sep
11
1 week ago
Activity icon

Started a new Conversation Failed To Mount Component: Template Or Render Function Not Defined.

Hello I'm trying to use Vue, and I'm quite new to it.

App.vue

<template>
  <div class="flex h-full">  
    <div class="h-full w-64 bg-green-300">
      <div class="h-16 bg-yellow-300 flex items-center justify-center">
        <p class="font-bold text-lg">our brand</p>
      </div>
    </div>
    <div class="h-full flex-1 bg-red-300">Main</div>
  </div>
</template>

<script>
    export default {
        mounted() {
            console.log('Component mounted.')
        }
    }
</script>

app.js

/**
 * First we will load all of this project's JavaScript dependencies which
 * includes Vue and other libraries. It is a great starting point when
 * building robust, powerful web applications using Vue and Laravel.
 */

require('./bootstrap');

window.Vue = require('vue');


// The following block of code may be used to automatically register your
// Vue components. It will recursively scan this directory for the Vue
// components and automatically register them with their "basename".
//  * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>

const files = require.context('./', true, /\.vue$/i)
files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))


Vue.component('dashboard', require('./components/App.vue'));

// Next, we will create a fresh Vue application instance and attach it to
// the page. Then, you may begin adding components to this application
// or customize the JavaScript scaffolding to fit your unique needs.


new Vue({
    el: '#root'
});

index.blade.php

    <div id="root">
        <dashboard></dashboard>
    </div>

I just copied the ExampleCompoent.vue

Sep
07
2 weeks ago
Activity icon

Replied to 1st Party Package Updates?

I'm not that dependent on them, I'm mostly curious when they will get updated, as they're referenced in the upgrade guide for Laravel 8

Activity icon

Started a new Conversation 1st Party Package Updates?

Hello,

When do people think that packages like Telescope, Horizon, Socialite & Passport will be updated to support Laravel 8?

Personally I'm using Telescope & Horizon quite often, I won't be able to after I update to Laravel 8.

Aug
21
1 month ago
Activity icon

Replied to Return Values Which Can't Be In An Array

So I'm having a DB records of all the ingredients that are available, and there will only be one of each in the DB, but when a user add a ingredient to an recipe, it'll be added to an array, and i don't want to give the user the same suggestions, as they've added to the recipe. $this->ingredients is the an array of the added ingredients.

Activity icon

Replied to Return Values Which Can't Be In An Array

Nope, it is more like to search a table and make sure it doesn' t returns values in an array. It is more like what @snapey said. But not sure how is it worked in a search. This is my code below hope it helps:

        $this->results = Ingredient::where('name', 'like', '%'.$v.'%')->limit(10)->get();
        $this->first = false;

        foreach($this->results as $result)
        {
            foreach($this->ingredients as $ingredient)
            {
                if($result == $ingredient)
                {
                    Arr::forget($this->results, $result);
                }
            }
        }
Activity icon

Started a new Conversation Return Values Which Can't Be In An Array

So it is possible to search a model, and make sure that the results can't be in an array of data?

Aug
20
1 month ago
Activity icon

Replied to Laravel Livewire Returns An Script Error

That worked.. Thanks

Activity icon

Replied to Laravel Livewire Returns An Script Error

It happens on when something changes, and i see the error in my console, the one accessed with ctrl + shift + i

Activity icon

Replied to Laravel Livewire Returns An Script Error

So I've done this in my app.blade.php

<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <!-- CSRF Token -->
        <meta name="csrf-token" content="{{ csrf_token() }}">

        <title>{{ config('app.name', 'Mad Databasen') }}</title>

        <!-- Fonts -->
        <link rel="dns-prefetch" href="//fonts.gstatic.com">
        <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">

        <!-- Styles -->
        <link href="{{ asset('css/app.css') }}" rel="stylesheet">

        @livewireStyles

    </head>
    <body>
        <nav class="navbar is-black" role="navigation" aria-label="main navigation">
            <div class="container">

                <div class="navbar-brand">
                    <a class="navbar-item" href="{{ route('home') }}">
                        Mad Databasen
                    </a>

                    <a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
                        <span aria-hidden="true"></span>
                        <span aria-hidden="true"></span>
                        <span aria-hidden="true"></span>
                    </a>
                </div>

                <div id="navbarBasicExample" class="navbar-menu">
                    <div class="navbar-start">
                        <a class="navbar-item" href="{{route('recipes')}}">
                            Opskrifter
                        </a>

                        <a class="navbar-item">
                            Documentation
                        </a>

                        <div class="navbar-item has-dropdown is-hoverable">
                            <a class="navbar-link">
                                More
                            </a>

                            <div class="navbar-dropdown">
                                <a class="navbar-item">
                                    About
                                </a>
                                <a class="navbar-item">
                                    Jobs
                                </a>
                                <a class="navbar-item">
                                    Contact
                                </a>
                                <hr class="navbar-divider">
                                <a class="navbar-item">
                                    Report an issue
                                </a>
                            </div>
                        </div>
                    </div>

                    <div class="navbar-end">
                        @if(Auth::guest())
                            <div class="navbar-item">

                                <div class="buttons">
                                    <button class="button is-primary register">
                                        <strong>Sign up</strong>
                                    </button>
                                    <button class="button is-light login">
                                        Log in
                                    </button>
                                </div>

                            </div>

                        @else

                            <a href="{{ route('notifications') }}" class="navbar-item">
                                <span class="icon">
                                    <i class="fas fa-bell"></i>
                                </span>
                            </a>

                            <div class="navbar-item has-dropdown is-hoverable">
                                <a class="navbar-link">
                                    {{Auth::user()->username}}
                                </a>

                                <div class="navbar-dropdown is-right">
                                    <a class="navbar-item" href="{{route('profile', Auth::user()->id)}}">
                                        Profil
                                    </a>
                                    <a class="navbar-item">
                                        Indstillinger
                                    </a>
                                    <a class="navbar-item">
                                        Contact
                                    </a>
                                    <hr class="navbar-divider">
                                    <a class="navbar-item has-text-danger">
                                        Report an issue
                                    </a>
                                </div>
                            </div>
                        @endif
                    </div>
                </div>

            </div>
        </nav>

        <section class="section">
            <div class="container">
                @yield('content')
            </div>
        </section>
        @livewireScripts
        <x-register-modal/>
        <x-login-modal/>
        @stack('scripts')
        <script src="{{ asset('js/app.js') }}"></script>
        <!--<script src="{{ asset('/node_modules/bulma-quickview/dist/bulma-quickview.min.js') }}"></script>-->
    </body>
</html>

Should I go and add this to my other views:

@push('scripts')
	<script src="{{ asset('js/app.js') }}"></script>
@endpush
Activity icon

Replied to Laravel Livewire Returns An Script Error

@sinnbeck does the Livewire need to be in those?

Activity icon

Replied to What Are The Alternatives Of Tinkerwell?

It depends on which of the functionality that you want. If you're looking for a 'copy' of Tinkerwell, I don't think there are any other alternatives without giving up some of the functionalities.

Activity icon

Replied to Can't Add Column To Existing Table

Cloud it be that you'll need the composer package doctrine/dbal. Install with the this command composer require doctrine/dbal.

Activity icon

Started a new Conversation Laravel Livewire Returns An Script Error

Hello, I'm trying to have Livewire to add new elements on a sidebar, however it returns an error.

Blade view:

<div>
    <div id="addIngredients" class="quickview @if(!$first == true) is-active @endif">
        <header class="quickview-header">
            <strong>@lang('recipes.ingredients.title')</strong>
            <span class="delete" data-dismiss="quickview"></span>
        </header>

        <div class="quickview-body">
            <div class="quickview-block px-3 py-3">
            <!--<button id="addNewIngredient" type="button" class="button is-success is-small is-fullwidth mb-3">@lang('recipes.ingredients.add')</button>-->
                <input class="input is-fullwidth" type="text" placeholder="Søg efter ingredients" wire:model="term" aria-haspopup="true" aria-controls="dropdown-menu">
                <div class="dropdown @if(count($results) > 0) is-active @endif">
                    <div class="dropdown-menu" id="dropdown-menu" role="menu">
                        <div class="dropdown-content is-fullwidth">
                            @foreach($results as $result)
                                <a wire:click="addIngredient('{{ $result->name }}')" class="dropdown-item">
                                    {{ $result->name }}
                                </a>
                            @endforeach
                            @if(count($results) == 10)
                                <hr class="dropdown-divider">
                                <a href="#" class="dropdown-item">
                                    Se flere ingredientser
                                </a>
                            @endif
                        </div>
                    </div>
                </div>
                <hr>
                <div id="ingredient-content">
                    <[email protected]($results)-->
                    @forelse($ingredients as $ingredient)
                            <div class="notification mb-3">
                                <button class="delete"></button>
                                <div class="columns is-multiline">
                                    <div class="column is-12">
                                        <p>Ingredients: @dump($ingredient)</p>
                                    </div>
                                    <div class="column is-6">
                                        <input class="input is-small" type="number" placeholder="4.584">
                                    </div>
                                    <div class="column is-6">
                                        <div class="select is-fullwidth is-small">
                                            <select>
                                                <option>Gram</option>
                                                <option>Kilo</option>
                                                <option>Pund</option>
                                                <option>Liter</option>
                                                <option>Deciliter</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                            </div>
                    @empty
                        <div class="notification">
                            Ingen ingredientser endnu! Søg efter dem oppe i tekstfelttet oven over.
                        </div>
                    @endforelse
                </div>
            </div>
        </div>

        <footer class="quickview-footer">
            <button class="button is-dark" data-dismiss="quickview">Gem!</button>
        </footer>
    </div>
</div>

Class:

<?php

namespace App\Http\Livewire;

use App\Models\Ingredient;
use Illuminate\Support\Arr;
use Livewire\Component;

class RecipeIngredientPanel extends Component
{
    public $term;
    public $ingredients = [];
    public $results = [];
    public $first = true;

    public function updatingTerm($v)
    {
        $this->results = Ingredient::where('name', 'like', '%'.$v.'%')->limit(10)->get();
        $this->first = false;

        foreach($this->results as $result)
        {
            foreach($this->ingredients as $ingredient)
            {
                if($result == $ingredient)
                {
                    Arr::forget($this->results, $result);
                }
            }
        }
    }

    public function addIngredient($addedIngredient)
    {
        array_push($this->ingredients, $addedIngredient);
    }

    public function render()
    {
        return view('livewire.recipe-ingredient-panel');
    }
}

The script error that it is giving me in the console:

VM1871:1 Uncaught (in promise) ReferenceError: Sfdump is not defined
    at eval (eval at initialize (node_initializer.js:13), <anonymous>:1:9)
    at Object.initialize (node_initializer.js:13)
    at onNodeAdded (index.js:379)
    at callHook (morphdom.js:35)
    at handleNodeAdded (morphdom.js:140)
    at handleNodeAdded (morphdom.js:164)
    at handleNodeAdded (morphdom.js:164)
    at handleNodeAdded (morphdom.js:164)
    at morphdom.js:407
    at morphEl (morphdom.js:219)```

And yes, I have included @livewireStyles & @livewireScripts
Aug
08
1 month ago
Activity icon

Replied to Polymorphic Relationships Doesn't Fill Out The Fields

Thanks! That helped me a lot. About the function, I figured that I could use $user->idsince that was provided by the die&dump, I'm using the Laravel SocialiteProvider's Discord integration (https://socialiteproviders.netlify.app/providers/discord.html).

Aug
06
1 month ago
Activity icon

Replied to Polymorphic Relationships Doesn't Fill Out The Fields

Hello @chr15k

I get the Discord User instance from Discord API.

Here is a picture of the response. https://i.imgur.com/Wut23KY.png

Aug
04
1 month ago
Activity icon

Replied to Laravel Member Filtering

Can I ask why you don't use the provided blade view?

Activity icon

Started a new Conversation Polymorphic Relationships Doesn't Fill Out The Fields

Hello, I'm having an issue with polymorphic relationships, when I try to make the relationship it doesn't fill out all the fields that it should.

I'm using the SocilateProviders Discord package.

My Models:

class DiscordAuth extends Model
{
    protected $guarded = [];

    public function auth()
    {
        return $this->morphOne(Auth::class, 'authable');
    }
}
class Auth extends Model
{
    protected $guarded = [];

    public function authable() {
        return $this->morphTo();
    }
}

My migrations:

        Schema::create('auths', function (Blueprint $table) {
            $table->id();
            $table->string('token');
            $table->morphs('authable');
            $table->timestamps();
        });
        Schema::create('discord_auths', function (Blueprint $table) {
            $table->unsignedBigInteger('id')->unique();
            $table->primary('id');
            $table->foreignId('user_id')->constrained('users');
            $table->string('email');
            $table->string('username');
            $table->string('discriminator');
            $table->timestamps();
        });

The controller that creates it

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

    /**
     * Obtain the user information from GitHub.
     *
     * @return void
     */
    public function handleProviderCallback()
    {
        $user = Socialite::driver('discord')->user();

        $discord = DiscordAuth::create([
            'id' => intval($user->id),
            'user_id' => Auth::user()->id,
            'email' => $user->getEmail(),
            'username' => $user->getName(),
            'discriminator' => $user->user['discriminator']
        ]);

        $discord->auth()->create([
           'token' => $user->refreshToken
        ]);

        dump($discord);
    }
}

Picture of the DB row that doesn't have it's ID filled: https://i.imgur.com/3ucjt88.png

Laravel fills the other fields completely fine, but for some reason, not authable_id

What have I done wrong?