Chrizzmeister

Chrizzmeister

Member Since 4 Years Ago

Antwerp

Software Engineer at Wappla

Experience Points 80,085
Experience Level 17

4,915 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 831
Lessons
Completed
Best Reply Awards 3
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

04 Jul
1 month ago

Chrizzmeister left a reply on Create Or Attach

Use sync() or attach() / detach() https://laravel.com/docs/5.8/eloquent-relationships#updating-many-to-many-relationships

Next time use google or the documentation :) they both are pretty good.

Chrizzmeister left a reply on How To Make A Custom Laravel Authentication Provider?

Not really sure what the adding-customer-user-providers does not explain? The point of your custom provider is that it has custom code related to your use-case?

  1. Add a custom service provider which links to your custom class
  2. change the default provider to your custom provider in auth.php or create a new one so you can switch between the two
  3. Make sure your custom class adheres to the UserProvider interface
  4. If you set this up you can use all the normal Auth:: methods, like Auth::user()

And a user-provider alone is probably not enough so also take a look at the custom guards: https://laravel.com/docs/5.8/authentication#adding-custom-guards

But when reading your post I think you actually just want to authenticate with an existing forum user, in that case, you probably want to use this: https://laravel.com/docs/5.8/socialite Take a look at the custom driver website https://socialiteproviders.netlify.com/, you can create your own custom driver for IP-board

IPBoard as a single-sign-on method which is probably what you need. Read the documentation and add your own socialite driver.https://invisioncommunity.com/services/sso/

27 Jun
1 month ago

Chrizzmeister left a reply on Polymorphism

If you are sure posts/groups are always exactly the same then sure you can use polymorphism, but if there differences between the two or you expect more differences in the future, you should just make 2 tables: Groups/posts. And yes they will both have similar columns, but that doesn't matter and will be way easier to manage in your code.

26 Jun
1 month ago

Chrizzmeister left a reply on Polymorphism

I don't really see the need for multiple tables. You can have a simple type column or just a bunch of date/boolean columns like: favorited_at or is_spam. In your code you can setup Scopes to simplify retrieving the results

14 Jun
2 months ago

Chrizzmeister left a reply on How To Create Composer Package ?

Laravel docs has a page dedicated to this. Also just looking at existing packages is the best way to learn.

https://laravel.com/docs/5.8/packages

25 Apr
3 months ago

Chrizzmeister left a reply on Horizon Job Timeout Issue

Same problem and not running multiple horizon setups on same server. Added different environments for staging/production also

18 Apr
4 months ago

Chrizzmeister left a reply on Routes Https On Loader Balance

@SOLUTIONSWIDE - Sorry for digging this up but @solutionswide problem is related to the order in the middleware stack. CheckForMaintance middleware happens before TrustedProxy so i think that moving TrustedProxy to the top of the stack solves this issue.

13 Mar
5 months ago

Chrizzmeister left a reply on Completion Status

I think the completion status is cached and is updated with a background-job. Come back tomorrow and it will be updated

02 Feb
1 year ago

Chrizzmeister left a reply on Unable To Test Filesystem TemporaryUrl

i have the same issue.

30 Jan
1 year ago

Chrizzmeister left a reply on Laravel Cashier Only For PDF Generator

use snappy or dompdf , but since you have cashier as example here is a link to a laravel wrapper for dompdf https://github.com/barryvdh/laravel-dompdf

09 Jan
1 year ago

Chrizzmeister left a reply on DRY In Php?

This question is a bit vague. DRY is not something ruby specific it is just a good way to program in general. DRY should always be the end goal. Since you are asking this question on laracasts here are some php/laravel related examples:

  • traits
  • parent/child classes
  • partials for views
  • components for views
  • extracting classes for a piece of functionality
  • extracting common tasks to dedicated classes
  • making a repository to bundle code
  • make a global helpers file for general helper function
  • all design patterns
  • ..

its pretty much endless , so you need to be more specific and show an example of what piece of code you would like to make dry.

20 Sep
1 year ago

Chrizzmeister left a reply on Homestead & Ngrok

@svpernova09 That is amazing! Thanks

10 Jul
2 years ago

Chrizzmeister left a reply on Laravel Training

I feel like you are a troll. Looking at your profile you have watched 3 videos. If you would have spent your time watching the FREE laravel fundamentals series https://laracasts.com/series/laravel-5-fundamentals or the FREE laravel from scratch series : https://laracasts.com/series/laravel-from-scratch-2017 . you would have known the basics of laravel in a couple of hours. Yet you spend all your time trolling people on the forums. Jeffrey is the go-to for learning laravel, if you can't learn from him you can't learn from anyone.

Did your really think anybody here understood 100% of everything that was going on in those videos the first time they watched it? Ofcourse not, but rewatching them and practicing will get you very far.

If you have really been a php developer since 1997 you should know that you have to learn to do this job. And since 1997 you had never any experience with any MVC ? Thats very hard to believe.

And you are saying Why to learn a framework? Well if you are working for a company that wants to make money, thats your reason. A framework will handle most of the stuff that you will have to do for every php web application. This means you will have to spend less time on that crap and spend more time on actually building a product. And time = money.

07 Jul
2 years ago

Chrizzmeister left a reply on Npm Run / Gulp Not Working

Are you on the latest version of laravel? Because it currently does not use gulp anymore.

You will to have to run : "npm run dev" or "npm run watch" or "npm run prod"

Chrizzmeister left a reply on Can't Load My Site After Composer Update

Since you were working on laravel 5.3 and ran update it probably upgraded to 5.4 so read the upgrade guide : https://laravel.com/docs/5.4/upgrade#upgrade-5.4.0

Chrizzmeister left a reply on How To Achieve Conditional Filtering (many Filters) In My Table.

If you are looking for a non-scout solution, take a look at this excellent video from jeffrey : https://laracasts.com/series/eloquent-techniques/episodes/4

Chrizzmeister left a reply on Knowledge Level Of JavaScript For Starting With Vue

its never too early or late to start learning a new framework. But a good practice would be that if you truly don't understand a concept explained in vue/react/angular,.. you might want to learn what is happening 'under the hood' so dive deeper in standard js for every thing you are struggling with.

04 Jul
2 years ago

Chrizzmeister left a reply on Adding Filesystems Disks Per Path?

The second approach is way better, the disks are meant for like the name suggests, different disks. So for example a disk for external storage on s3 or a public folder.

If you you change disks and you follow the first approach you need to duplicate all entries in your filesystems.php file or need to manually change all drivers .

If you follow the second approach you simply need to change the value of disk.

$path = '/photos/p/';
Storage::disk('public')->put(
                $path . $filename . $ext,
                $file
        );
$path = '/photos/p/';
Storage::disk('s3')->put(
                $path . $filename . $ext,
                $file
        );
24 Apr
2 years ago

Chrizzmeister left a reply on Cannot Add Foreign Key Constraint

@michaeldyrynda , I know you wrote this 2 years ago , but i am suprised by this line:

Make sure you create your foreign keys before you insert any data. Best >practice is to make the foreign key field nullable, as NULL is the only value >you will be able to use, other than a foreign value.

Is this really the case? I never knew this and i'm pretty suprised. Can you tell me what advantages this gives?

10 Apr
2 years ago

Chrizzmeister left a reply on Friends

you could always take a look at this series. Its a old one, but you will get some usefull info out of it. Jeffrey builds a mini-facebook https://laracasts.com/series/build-a-laravel-app-from-scratch

04 Apr
2 years ago

Chrizzmeister left a reply on Markdown To Pdf

Ok i found a solution. I used the Dompdf package and just reused the vendor/html components which just parse all markdown into html. I can just use those components inside a pdf layout file which loads the provided email css.

Chrizzmeister started a new conversation Markdown To Pdf

hi, i was wondering if there is a easy way to use the markdown-email system to generate pdfs. Or maybe there is a tool to do it? i know how to generate pdf's from blade but not sure how to do it with markdown

02 Mar
2 years ago

Chrizzmeister left a reply on Am I The Only One That Find The Difference Between Events/listeners, Jobs And Notifications Difficult To Understand?

it depends on te size of your project, but in my current project i have the same Observer/listener combo like you, but instead of doing Mail::to() inside that listener. I do $user->notify() in that listener. Which means that when i want to also send a message to slack when a userHasBeenRegistered i don't need to add a other Listener to the event, but i just can modify my notification class.

So my point is that you don't have to choose . You can have Events/Notifications/Jobs together if you have a complex problem. But for simple things just choose what fits your project.

28 Feb
2 years ago

Chrizzmeister left a reply on Update Form Data Laravel 5.2

Watch this series: https://laracasts.com/series/laravel-from-scratch-2017 it's free. since you are struggling with the basics.

14 Feb
2 years ago

Chrizzmeister left a reply on Using Laravel 5.3 Storage With Canvas() From Intervention Image

This was the answer

$path = $request->file('logo')->store('/clients/logos','public');

// creating a canvas
$canvas = Image::canvas($width, $height);


$image = Image::make(storage_path("app/public/" . $path))->resize($width, $height, 
    function ($constraint) {
        $constraint->aspectRatio();
});

$canvas->insert($image, 'center');

// pass the full path. Canvas overwrites initial image with a logo
$canvas->save(storage_path("app/public/" . $path . ".png"));
``
05 Feb
2 years ago

Chrizzmeister started a new conversation Using Laravel 5.3 Storage With Canvas() From Intervention Image

Running Laraval 5.4 with Vagrant and Homestead.

Saw a few other questions regarding this issue but none provided a solution which uses the canvas() method by Intervention/Image

My current code:

$path = $request->file('logo')->store('/clients/logos','public');

$canvas = Image::canvas($width, $height);
$image = Image::make($path)->resize($width, $height, function ($constraint)
{
    $constraint->aspectRatio();
});

$canvas->insert($image, 'center');
$canvas->save($path);

$this->logo_path = $path;

This code creates a canvas and places a resized image inside it.

This code gives following error:

NotReadableException in AbstractDecoder.php line 335: Image source not readable in AbstractDecoder.php line 335 at AbstractDecoder->init('clients/logos/UupUn1iuDGRsy5Z0bkWHJ6S4v79bfZiXapTO7vLk.jpeg') in AbstractDriver.php line 64

The first line works, because the image is stored inside my storage folder at the following location:

"/storage/app/public/clients/logo/UupUn1iuDGRsy5Z0bkWHJ6S4v79bfZiXapTO7vLk.jpeg"

but the image is stored in full-size, so the code fails at the image-intervention part.

Things i tried: I tried changing the $path variable inside Image::make() to this:

Storage::disk('public')->url($path)

which results in following error: Can't write image data to path

(http://test.dev/storage/clients/logos/owjNA5Fn9QyYoS0i84UgysaFLo5v0NzbOiBhBzXp.jpeg)

The weird part about that error is that the 'app' directory is not visible inside that error.

I'm running out of ideas to solve this issue.

02 Feb
2 years ago

Chrizzmeister left a reply on Stripe Vs Paypal

This is not really a comparison . Stripe offers several payment methods while Paypal is one payment method. It depends on what your users want. But the choice should be between a service like Braintree or Stripe . Braintree offers Paypal as a payment method.

24 Jan
2 years ago

Chrizzmeister left a reply on Auth Laravel 5.2 Vs. Laravel 5.3

Yes, that's fine. The web middleware is added by default , so no need to worry about that. You can put it in a constructor of your controller or wrap all your routes that need that middleware with a Route::group()

https://laravel.com/docs/5.4/routing#route-group-middleware

30 Nov
2 years ago

Chrizzmeister started a new conversation Append The Current Request To New Get Request

Hi,

I have a form on my homepage where the user can filter on various elements located on the website. I am using the structure Jeffrey showed in this video: https://laracasts.com/series/eloquent-techniques/episodes/4 .

This all works fine.

But on the results page of this GET-request i added an extra form to sort the results. So e.g. I want to sort all the results from the get request based on price. But obviously after i sort based on price the old Query is lost.

I know you can use : {{ $listings->appends(Request::except('page'))->links() }} to make the current results paginated. But can i somehow use this appends method on a new form?

Current second form:

<form id="listing-filter-box" action="{{LaravelLocalization::localizeURL(trans('routes.listing-overview'))}}" method="get" 
      accept-charset="utf-8">
        <select class="form-control" name="sorting">
          <option value="" disabled selected>{{trans('forms.sort-conditions')}}</option>
          <option value="price_asc">{{trans('forms.sort-price-asc')}}</option>
          <option value="price_desc">{{trans('forms.sort-price-desc')}}</option>
          <option value="date_latest">{{trans('forms.sort-latest')}}</option>
          <option value="date_oldest">{{trans('forms.sort-oldest')}}</option>
        </select>
      </form>

So i would like to add something like : appends(Request::except('sorting')) to this form. Does anyone can help me with this issue

25 Nov
2 years ago

Chrizzmeister started a new conversation Send Email When Date Almost Expires

Hi,

So i have a database column called Expiry_date . When the expiry date is less than a month from now i need to send an Email. But i'm not sure how to handle that. Do i need to create a event to listen for that? I never really worked with events so not really sure where to start.

I'm not asking for code, just some quick tips where i should look for information about this or which videos to watch on this kind of subject

04 Nov
2 years ago

Chrizzmeister left a reply on Open Source My Portfolio Site?

I don't agree with @maitrefrantz , every job interview i had for a back-end job . They always ask if i have a Github/Bitbucket account where they can see my coding style. So, yes it is good to make it open source, just hide your personal info.

03 Nov
2 years ago

Chrizzmeister started a new conversation Best Approach To Preselect 2 Fields Inside Same Table

I couldn't find a good title for this question, so sorry about that.

The situation

So i offer price plans on a application. Currently the website-adminstrator can add price plans in the admin-area. He also has the ability to add a checkmark to a price plan to make it préselected on the front-end of the website. (This is necessarry because users on the website need to select a price plan with the help of radio-buttons).

The priceplans are currently situated in 1 table . The préselected field is a ` boolean called ` isFeatured

My current validation rule is : 'is_featured' => 'unique:formulas,is_featured,0,id,is_featured,1',

The problem

Recently we have the need to have 2 types of price plans. So what is the best approach to handle this? My first thought was to have a new table called types. The price plans would have a hasOne relationship to the Type. The problem with this approach however is that the admin still needs to have the ability to préselect a price plan that will be highligted. That means that there will be 2 price-plans that are preselected. I am not sure if i can validate that .

A important thing to note is that the priceplan will only be of 2 types. Those 2 types will never change (no they won't). So adding a extra field to priceplans called isTypeX whould also be an option , but that generates the same problem for validation.

I also coud make 2 seperate tables for each type of price-plan. But that would be overkill imo.

28 Oct
2 years ago

Chrizzmeister left a reply on Create Unique Value In Laravel?

Depends on what you mean. If you mean checking for a unique value in the controller (so when you validate a form input for example) @InaniELHoussain answer is correct. But if you mean on the migration yourself, you can just append ->unique() to the migration . For example: $table->string('name')->unique();

You should do it both btw.

27 Oct
2 years ago

Chrizzmeister left a reply on Dropzone.options - Dropzone Is Not Defined

I'm having the exact same issue.

Chrizzmeister left a reply on Best Platform For Laracasts Courses

Ubuntu will be a bit easier for terminal stuff, but it works both just fine.

22 Oct
2 years ago

Chrizzmeister left a reply on Will A Model Called File Give Me Issues?

@Snapey its a dropbox like app , so it can be of multiple types. So FileAttachment seems like a ok choice. Was thinking about UploadedFile

Chrizzmeister started a new conversation Will A Model Called File Give Me Issues?

Hi,

Maybe a dumb question but i am building a little app for File uploads. The obvious name for my File model would be File, but is this a good idea since there are File helper functions etc. If it's a bad idea what should i call it?

08 Sep
2 years ago

Chrizzmeister left a reply on Store Session Data Best Practice

i do validate each step, that's just not including in my code example. The code shown is after i validate that step . I understand that step, i just wanted to know if using request->all() is bad, since it's all data including token information etc.

Chrizzmeister left a reply on Store Session Data Best Practice

I mean using Request->all() , but thanks for the video did not watch that one yet.

the problem might be with File uploads i suppose. Should i store file uploads in the session? that seems a bad idea. Those i probably need to save to the storage first and if the user closes it browser or doesn't complete the last step i need to remove it somehow.

Chrizzmeister started a new conversation Store Session Data Best Practice

Hi, i have a multi-step form for my current website.

I decided to go with the Session approach of storing each step in the session, that way i can validate each step.

Since i never used this approach before, i would like to know if the following code is ok, or if it's bad practice

 session(['stepOneData' => $request->all()]);

 $testing = session('stepOneData');

when i dd() my $testing i get exactly what i need, but is it better to split up the data in smaller chunks or ?

05 Sep
2 years ago

Chrizzmeister left a reply on Correct Way To Delete A Nullable Relation

@ohffs That seems like the best solution. The only problem is that i already wrote some functionality with the above setup in mind, but in the long run this probably is better.

Chrizzmeister left a reply on Correct Way To Delete A Nullable Relation

@Uxibete , thanks for your answer. What's the benefit of using this method instead of the one i used?

Chrizzmeister started a new conversation Correct Way To Delete A Nullable Relation

Hi,

I have a users table and a addresses table. This is a one to many relationship where a user has one address but an address can belong to many users (if people live together and both register on the website).

When a user account is deleted i want to remove the address related to the user. I normally would do this in my database migrations like so:

$table->integer('address_id')->unsigned()->nullable();
$table->foreign('address_id')->references('id')->on('addresses')->onDelete('cascade');

The reason the address_id is nullable is because users can register without specifying their address. The above code doesn't delete the address when i delete a user.

So i did the following on my user model:

 public function delete()
    {
      File::delete([
        $this->professional_logo,
      ]);

      $this->address()->delete();

      parent::delete();
    }

The above code works, but the question is if this is the correct way of doing it? Should i remove the constraint on the migration? Should i put this inside a model event? (never worked with them ). I already read a few forum threads about this, and it's ok that this is not a soft delete.

12 Aug
3 years ago

Chrizzmeister left a reply on Should I Seperate Single Row Tables?

yeah that seems like the best approach. just adding extra columns to my options table if more options are needed.

I think i'm just gonna seed 1 row in that table with standard value and the only user interaction that can happen is updating that row, not adding/deleting it.

Chrizzmeister started a new conversation Should I Seperate Single Row Tables?

On my website i have some available options

For example:

  • Analytics code (will always just be 1 single value for the website)
  • Maintenance mode (always 1 or 0)
  • ...

Should i split these options into separate tables? So in this case that means a Table for Analytics and a Table for Maintenance Mode . This is more convenient for development. But is this really a good practice?

Or should i make 1 options table? But how would this work in actual development? I could seed a single row in the options table with default values and when a user changes or adds an option i always just update that single row. This second option also seems like bending the rules.

11 Aug
3 years ago

Chrizzmeister left a reply on Validate If A Boolean Field Is Unique In A Table

@Red thank you very much! Was pulling my hair out on this one.

Chrizzmeister started a new conversation Validate If A Boolean Field Is Unique In A Table

Hi,

The situation

A table with pricing formula's . The fields include Name, price, months, is_featured.

On the front-end of my website a list is loaded with all the available pricing formulas. One of the formulas is selected by default.

In the back-end panel of my website the admin can add/update/delete formulas. On the creation field of my form i have a checkbox to indicate if the current formula needs to be selected by default.

Question

How can i validate this field ? because only one formula could be featured by default. Is this a constraint i should add on the migration itself or in the controller? and how would i even start on validating that behaviour?

02 Aug
3 years ago

Chrizzmeister left a reply on Php Artisan Tinker Not Running

Since i am using Laravel Valet this issue has solved itself . So it seems it was related to MAMP . Still not sure what the actual reason is.