Sinnbeck

Programmer at Aalund

Member Since 5 Years Ago

Hadsten

Experience Points
839,880
Total
Experience

0 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
180
Lessons
Completed
Best Reply Awards
1295
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 50
839,880 XP
Feb
21
5 days ago
Activity icon

Replied to Change Php Versions Using Valet

Brilliant. I don't suppose it fixes the issue, but it does seem very nice none the less

Activity icon

Replied to Change Php Versions Using Valet

Actually got it working by just requiring valet from composer again (which downgraded its dependencies (-W)

Activity icon

Started a new Conversation Change Php Versions Using Valet

Started using a Mac and laravel valet. I downgraded to php5.6 to see if it worked for some old code. But now it seems a cannot upgrade to 7.4 again? 🤔

It simply tells me that I am using a too old version for composer to run

Jan
30
3 weeks ago
Activity icon

Replied to Do You Care About All The PHP8 Warnings In PHPStorm?

I would go by whan the project requirement is. Never go higher than what you are developing on or you could by accident something that would break 7.4. So if you plan to upgrade to 8, fix those squiggles and get your server upgraded.

Jan
26
1 month ago
Activity icon

Awarded Best Reply on HTML Not Escaping Inside Of A Textarea

A <p> tag isnt a valid child of a textarea.

Try pasting

<textarea><p>test</p></textarea>

into https://htmledit.squarefree.com/

In other words, it works as expected.

Activity icon

Replied to HTML Not Escaping Inside Of A Textarea

A <p> tag isnt a valid child of a textarea.

Try pasting

<textarea><p>test</p></textarea>

into https://htmledit.squarefree.com/

In other words, it works as expected.

Activity icon

Replied to Livewire With Composite Keys

I am aware, but I work around it :) Sadly I cannot change the database as it is used by other programs.

Activity icon

Replied to Livewire With Composite Keys

I seem to have found a way to skip the hydration of the collection, but it feels a bit hacky

public function dehydrateItems()
    {
        $this->items = [];
    }
Activity icon

Started a new Conversation Livewire With Composite Keys

I am playing around with livewire, but have run into an issue.

The database I am using does not have an ID column, but instead have a composite key on two columns (project_id, item_id). I have an action to got to a new page, where I try setting the array of items again.

The problem is that livewire tries to hydrate the data between visits. This leads it to try loading the instances again, using a primary key.

Is it possible to tell it to skip the hydration process for certain properties?

Jan
21
1 month ago
Activity icon

Awarded Best Reply on Image Not Change In Saving In Database

Did you forget to add enctype='multipart/form-data' to the form?

Jan
17
1 month ago
Activity icon

Awarded Best Reply on Showing A Description Without Html Tags And Limit Chars

You can strip_tags

strip_tags($product->description)
Dec
30
1 month ago
Activity icon

Awarded Best Reply on Inertia.js Child Component Props/data?

You are correct that controllers are route bound. There is currently no way of binding data to multiple (but not all) routes. Laravel has this nativly (view composers) but inertia still lacks this feature sadly.

You have 2 possibilities

  1. Share the data on all routes
  2. Add the data to the controller of all routes that need it.
Dec
28
1 month ago
Activity icon

Replied to Inertia.js Child Component Props/data?

You are correct that controllers are route bound. There is currently no way of binding data to multiple (but not all) routes. Laravel has this nativly (view composers) but inertia still lacks this feature sadly.

You have 2 possibilities

  1. Share the data on all routes
  2. Add the data to the controller of all routes that need it.
Dec
21
2 months ago
Activity icon

Replied to SQLSTATE[42S22]: Column Not Found: 1054 Unknown Column 'category_id' In 'where Clause'

$related_products = Product::with('categories')
            ->whereHas('categories')
            ->where('category_id', $product->category_id) // the products table does not have this column!
Activity icon

Awarded Best Reply on Rename Files Based On Class

We ended up doing a small script for replacing the file names :) Uses ripgrep instead of regular grep

#!/bin/bash
for FILE in *.php
do
    NEWFILE=$(rg -N --only-matching --no-filename '^class ([^ ]+)' -r '' $FILE)
    if [ "$NEWFILE" != "" ]
    then
      NEWFILE+=".php"
      echo "$FILE will be replaced with $NEWFILE"
      git mv "$FILE" "$NEWFILE"
    fi
done
Activity icon

Replied to Rename Files Based On Class

We ended up doing a small script for replacing the file names :) Uses ripgrep instead of regular grep

#!/bin/bash
for FILE in *.php
do
    NEWFILE=$(rg -N --only-matching --no-filename '^class ([^ ]+)' -r '' $FILE)
    if [ "$NEWFILE" != "" ]
    then
      NEWFILE+=".php"
      echo "$FILE will be replaced with $NEWFILE"
      git mv "$FILE" "$NEWFILE"
    fi
done
Activity icon

Started a new Conversation Rename Files Based On Class

I am working on refactoring an old codebase that uses lowercase folder and file names as it has its own autoloader. I want to set it to use composer autoload instead, and therefor need to refactor alle filenames (and folders) to have the proper casing (psr4).

Does anyone know of any way this can be done automatically? I have phpstorm if that can help.

Activity icon

Replied to Override Route In Web.php From Package

I dont think you can override routes set by a user. But just remove the route from web.php

Activity icon

Replied to The Mix Manifest Does Not Exist

Did you get it solved? You seem to have a syntax error in the package.json file. If not, try posting the content of the file.

Dec
19
2 months ago
Activity icon

Awarded Best Reply on Which Docker Source Is Preferable For Installing Laravel Under Docker ?

Well first of all php:7.3-apache is apache and php in the same container..

The php:7.3-fpm is just php but with FPM (a protocol for communication) enabled. This means that you can move your webserver to a different container. Both nginx and apache2 supports FPM, but if you plan to do this I suggest using nginx as it is WAY easier to setup :)

Regarding alpine, this is just a minimalistic platform to start from. Imagine removing EVERYTHING from linux (only the kernel left).. This makes your images way smaller (the base image is 8 MB I think), but also requires you to install more stuff yourself (and it has its own package manager as well)

Dec
18
2 months ago
Activity icon

Awarded Best Reply on Image Saves As Tmp

You are setting the logo incorrectly twice

$admin->logo = request('logo'); //remove this!

$admin->update($request->all()); // and this
$admin->save(); // and use this instead
Activity icon

Replied to The Mix Manifest Does Not Exist

DId npm install give any errors? Try running it again and see

Activity icon

Awarded Best Reply on Php Artisan Migrate Gives Sql Error

Ok. Do you still have the user you created? Try with that again, and post the new error if one comes

Activity icon

Replied to Php Artisan Migrate Gives Sql Error

Ok. Do you still have the user you created? Try with that again, and post the new error if one comes

Activity icon

Replied to Php Artisan Migrate Gives Sql Error

How are you running your database? Also it seems your config might be cached

php artisan config:clear
Activity icon

Replied to Image Saves As Tmp

You are setting the logo incorrectly twice

$admin->logo = request('logo'); //remove this!

$admin->update($request->all()); // and this
$admin->save(); // and use this instead
Activity icon

Replied to Package For Querying Facebook Graph API

Seems someone has forked it and updated it to work with newer versions

https://github.com/scottybo/laravel-facebook-sdk

Activity icon

Replied to Sinhala Font Not Working In Dom Pdf

  1. Did you read this https://github.com/dompdf/dompdf/wiki/About-Fonts-and-Character-Encoding
  2. If yes, please show some code, and what happens.
Dec
17
2 months ago
Activity icon

Replied to How To Excel File Export With Client Name?

A PR is a Pull Request. It means that you clone the official repo to your own computer, make changes, and then push them back to the official package repo. The own can then merge your changes in if they like them.

Activity icon

Awarded Best Reply on How To Excel File Export With Client Name?

Do you mean the file name?

Excel::create($clientModel->name,
Activity icon

Replied to How To Excel File Export With Client Name?

Oh. Didnt think windows supported : in filenames. I would assume : arent allowed as some OS does not support them.

I am quite sure that the excel package replaces them. You can consider creating a PR to allow :

Activity icon

Replied to How To Excel File Export With Client Name?

I dont think : is allowed in filenames at all. Are you able to create a file on you computer with : in the name?

Activity icon

Replied to How To Excel File Export With Client Name?

Do you mean the file name?

Excel::create($clientModel->name,
Activity icon

Replied to HTML/CSS To PDF Library

Give browsershot a try. It uses puppeteer under the hood

https://github.com/spatie/browsershot

Activity icon

Replied to Error : Trait Is Not Found (using In Models)

Sadly I cannot recreate the error. Try deleting the old HasPermissions file and creating a new. Now make sure that it works.. Then copy in the class definition and a single method, and see if it works

Dec
16
2 months ago
Activity icon

Replied to I Got Symfony Error Message On Production Server.

Try setting the post_max_size on the server to a larger value

If that is high enough, please post the validation logic :)

Activity icon

Awarded Best Reply on Problem Install Nova-translatable: Class 'Spatie\NovaTranslatable\Translatable' Not Found

Try importing the file, and running composer dump-autoload

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Spatie\NovaTranslatable\Translatable;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Translatable::defaultLocales(['en', 'fr','it']);
    }
}
Activity icon

Replied to Problem Install Nova-translatable: Class 'Spatie\NovaTranslatable\Translatable' Not Found

Try importing the file, and running composer dump-autoload

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Spatie\NovaTranslatable\Translatable;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Translatable::defaultLocales(['en', 'fr','it']);
    }
}
Activity icon

Replied to Problem Install Nova-translatable: Class 'Spatie\NovaTranslatable\Translatable' Not Found

Did it install properly?

Check your composer.json file if it is listed in there

Activity icon

Replied to Xdebug Is Installed But Impossible To Debug In PHPStorm With Homestead

Start by checking your config in phpstorm

Run->Web server debug validation

Activity icon

Replied to Laravel Config To Collection To Blade To Vue - Getting String, Need Array Or Object

What if you dont set the config to be an object (allow it to be an array)

return [
  'faqs' => [
    0 => [
      'title' => 'First FAQ entry',
      'content' => 'Etiam porta sem malesuada'
    ],
    1 => [
      'title' => 'Second FAQ entry',
      'content' => 'Vestibulum id ligula'
    ],
    2 => [
      'title' => 'Third FAQ entry',
      'content' => 'Nulla vitae elit '
    ],
  ]
];
Activity icon

Replied to Laravel Config To Collection To Blade To Vue - Getting String, Need Array Or Object

Give this a shot

  $faqs = config('widget-help.faqs'); //controller

<faq-widget faq-items="{{ json_encode($faqs) }}"></faq-widget>
Activity icon

Replied to Error : Trait Is Not Found (using In Models)

Can you post the code for the class so we can test it out? In your original screenshot I see no errors besides the red error icon

Community Pillar

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