ftiersch

ftiersch

Member Since 4 Years Ago

Experience Points
111,055
Total
Experience

3,945 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
101
Lessons
Completed
Best Reply Awards
159
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.

Level 23
111,055 XP
Nov
19
3 days ago
Activity icon

Awarded Best Reply on Getting Distance Conditional Relation

A scope is not a relation, only a "named" chunk of query basically :) You could use it like this:

Product::type()->get();

But it wouldn't work the way you have it setup because in a scope you usually don't even have the actual eloquent model yet. I'm not a hundred percent sure what you are trying to achieve but maybe polymorphic relations would be what you are looking for?

Nov
13
1 week ago
Activity icon

Replied to Getting Distance Conditional Relation

A scope is not a relation, only a "named" chunk of query basically :) You could use it like this:

Product::type()->get();

But it wouldn't work the way you have it setup because in a scope you usually don't even have the actual eloquent model yet. I'm not a hundred percent sure what you are trying to achieve but maybe polymorphic relations would be what you are looking for?

Activity icon

Replied to Searching Products Slow - Cache Image?

It could be one of a million of reasons but "slow" is just not something we can help you fix unless we know the correct definition :)

A cache can absolutely make websites load faster. If a browser caches an image it doesn't have to download it when the user goes on the page again (but it won't help for the first visit because then the cache is empty). If calculating something (or getting a large result set from the database) takes 10 seconds and you cache it into redis it will absolutely be faster but also the data won't be "live" anymore. So if it changes you need to take care of invalidating that cache to get the update to the user again.

VueJS doesn't necessarily optimize stuff. But if you use npm run production to build your JS it will automatically be minified and uglified, yes.

Activity icon

Replied to Searching Products Slow - Cache Image?

First of all that depends on what you mean by "slow"...

Slow until the page starts loading? Then images probably don't have anything to do with it but the most likely thing are slow database queries.

Slow until all the JS and images are loaded, but the title for example loads fast? Then you need to optimize those by making them as small as they appear, optimize them and minify / uglify the JavaScript code.

Nov
11
1 week ago
Activity icon

Awarded Best Reply on Print Certificate When The Trainer End The Course !

That depends on the format you want to give it to him in.

If you want to create a PDF you could use something like https://github.com/barryvdh/laravel-snappy or (more convenient but a little harder to host) https://github.com/spatie/browsershot :)

Nov
09
1 week ago
Activity icon

Replied to Fill

Literally the first result when you google "laravel fill"

https://laravel.com/docs/5.8/eloquent#mass-assignment

Nov
05
2 weeks ago
Activity icon

Replied to Triggering A Model Function On Login

You can use a Login Event. There is a part of the documentation that describes this:

https://laravel.com/docs/5.7/events#writing-event-subscribers

So you write a Listener class, go to EventServiceProvider and make that Listener listen to the Login Event and in that Listener you can execute your code :)

Activity icon

Replied to Problem Saving Multiple <fieldset></fieldset> Inputs In My Form To Mysql Database.

It's not depending on the fieldset, only on the field names.

It is a little tricky though because you have multiple values for every fieldset.

You could either do something like this:

<input type="text" name="comment[]">
<input type="text" name="title[]">

And then work with the numeric keys of an array. Or you do something like this:

<input type="text" name="data[1][comment]">
<input type="text" name="data[1][title]">

Then you can work with a single array that has your values.

foreach (request('data') as $values) {
    Log::create($values);
}

Just an example of course :)

Activity icon

Replied to Problem Saving Multiple <fieldset></fieldset> Inputs In My Form To Mysql Database.

  1. If you want to send an array to the server you need to call the variable comment[] for example. Then PHP will understand it's actually multiple values. Otherwise it will just use the last one because that overwrites all the previous ones.

  2. You need to have a loop in your backend if you want to create multiple Log entries.

foreach (request('comment') as $comment) {
    Log::create([
        'comment' => $comment,
    ]);
}

Something like this :)

Activity icon

Replied to Eloquent Only Returning 1 Item From ->get()

You can just get all of them and then group them later in the collection.

For example like this:

$data = CustomerScan::get()->groupBy(function ($scan) {
    return $scan->created_at->toDateString();
});

(of course you will have to add all your where methods and stuff, just remove the group by from the query and move it to the end :))

Edit: I just noticed you did that already. So yes, @sinnbeck is right. Just remove the groupBy from the query (not the last one) and you should get your result.

Nov
04
2 weeks ago
Activity icon

Replied to "message": "Server Error" Response After Clicking Submit

I think you have to fetch the row first before you can call value() on it.

$email = User::where('id', $applicantId)->first()->value('email');
Nov
02
2 weeks ago
Activity icon

Replied to How To Make Laravel Load Very Fast

Before you think about Laravel itself think about all the other things that are easy wins...

  1. Optimize your images and display them in the correct size (don't display full size images as a thumbnail)
  2. Possibly lazyload images
  3. Minify, uglify and gzip JavaScript

Those are usually the biggest "offenders".

The next one is probably not on Laravel itself but on Database queries. Optimize those.

After all of that you can work on smaller stuff. Caching etc.

Activity icon

Replied to Showing Bar Chart

@foreach ($list as $listItem)
{
        "label": {{ $listItem->menu }},
        "value": {{ $listItem->view }}
    }
@endforeach
Activity icon

Replied to Showing Bar Chart

In the PageSeen table but you are getting multiple records from the pageseen table in a collection. You need to select one of them.

For example

$list->first()->menu
Nov
01
3 weeks ago
Activity icon

Awarded Best Reply on Manual Password Reset Hash Value Decode Problem

You can't decode hashes. That's the point. What are you trying to achieve?

Activity icon

Replied to Query Returning Unexpected Results

Nah, I think he means imagining it as a timeline :) Left is 0 so if you point the arrow to the left < you check for "older"

Activity icon

Replied to Query Returning Unexpected Results

"newerThan" would be a >=, not a <= :) You accidentally programmed "olderThan"

Activity icon

Replied to Help

Can you show an example?

Possibly the method runs before the data is actually there. In the template that's not a problem because it's reactive and just changes as soon as the data is there but a method doesn't do that.

Activity icon

Replied to Exception With No Request Or Session

I think that exception is thrown before your session is even started (but not totally sure) because it happens while Laravel tries to determine which route to send the user to. And because it can't find a route with the given method it throws an exception.

Could absolutely be a bot, yes. If you're sure you're only sending POST requests to that route that's probably very likely. But remember if you redirect to that route it will also be a GET request - maybe that's the problem. (a redirect()->back() or something like that).

Oct
31
3 weeks ago
Activity icon

Awarded Best Reply on Regression

Basically it's (part of) what you do with UnitTests and so on.

You develop feature A and test it so it works.

Now you develop feature B but while developing it you accidentally break feature A. That would be a regression. To avoid that you would have to test every feature on your site everytime after creating a new feature. That are regression tests.

And to make that process easier there are automated tests like UnitTests so you don't actually have to do it yourself. :)

Source: German Wikipedia.

Oct
30
3 weeks ago
Activity icon

Awarded Best Reply on Difference Between Two Times In Seconds

Well yeah, because your "endTime" is the start of today so the diff in seconds would be quite large.

$refresh = now()->addDay()->startOfDay()->diffInSeconds(now());

This should give you the seconds until midnight if I'm thinking correctly.

Activity icon

Awarded Best Reply on How Do I Decrypt An Encrypted Mutator In A JSON Output?

The accessors and mutators are only called when you use the variable explicitly.

You could use a Resource for your Patient and inside there it would be called explicitly and decrypted automatically. Also with that you will have finer control what values are actually returned (if you are using an API here).

Another possibility would be to use Eloquent events (saving and retrieved maybe?) to only encrypt the values while writing them to the database because I guess in your code you don't need the encrypted values?

Activity icon

Replied to Difference Between Two Times In Seconds

Well yeah, because your "endTime" is the start of today so the diff in seconds would be quite large.

$refresh = now()->addDay()->startOfDay()->diffInSeconds(now());

This should give you the seconds until midnight if I'm thinking correctly.

Oct
29
3 weeks ago
Activity icon

Replied to How Can I Find If Json Has An Email?

Just change @lostdreamer_nl 's answer a little to use arrays instead of objects:

$data = collect(json_decode($jsonData, true));

$emails = $data->filter(function($object) { return $object['fiador'] == 1; })
    ->map(function($object) { return $object['eMail']; })
->toArray();
Activity icon

Replied to Print Certificate When The Trainer End The Course !

That depends on the format you want to give it to him in.

If you want to create a PDF you could use something like https://github.com/barryvdh/laravel-snappy or (more convenient but a little harder to host) https://github.com/spatie/browsershot :)

Activity icon

Replied to How Can I Find If Json Has An Email?

value.filter(object => {
    return object.fiador == 1;
}).map(object => {
    return object.eMail;
});

this gives you an array with all the emails. Now you can do with them what you like. For example filter empty ones or just get the first one :)

Activity icon

Replied to Delete

Did you reload your page before you tried the method('put')?

Happens to me all the time that I change HTML stuff, click on "submit" in the form and wonder why it doesn't work and the next time it works because I actually refreshed my HTML with that submit and forgot before.

Activity icon

Replied to How Do I Decrypt An Encrypted Mutator In A JSON Output?

The accessors and mutators are only called when you use the variable explicitly.

You could use a Resource for your Patient and inside there it would be called explicitly and decrypted automatically. Also with that you will have finer control what values are actually returned (if you are using an API here).

Another possibility would be to use Eloquent events (saving and retrieved maybe?) to only encrypt the values while writing them to the database because I guess in your code you don't need the encrypted values?

Oct
28
3 weeks ago
Activity icon

Awarded Best Reply on Drop Down List In Laravel Booking Form

Sure, the Laravel Collective doesn't do any magic. You just have to program the logic yourself :)

You basically create a foreach loop for your countries like that:

<select name="country">
    @foreach ($countries as $country)
        <option value="{{ $country }}" @if(old('country', 'default country') == $country) selected="selected" @endif>{{ $country }}</option>
    @endforeach
</select>
Activity icon

Replied to Drop Down List In Laravel Booking Form

Sure, the Laravel Collective doesn't do any magic. You just have to program the logic yourself :)

You basically create a foreach loop for your countries like that:

<select name="country">
    @foreach ($countries as $country)
        <option value="{{ $country }}" @if(old('country', 'default country') == $country) selected="selected" @endif>{{ $country }}</option>
    @endforeach
</select>
Activity icon

Awarded Best Reply on How Do I Sort And Group Tasks By Complete Status

You could do something like this:

'pendingTasks' => $project->tasks->filter(function ($task) {
    return !$task->completed;
}),
'completeTasks' => $project->tasks->filter(function ($task) {
    return $task->completed;
}),
Activity icon

Replied to How Do I Sort And Group Tasks By Complete Status

You could do something like this:

'pendingTasks' => $project->tasks->filter(function ($task) {
    return !$task->completed;
}),
'completeTasks' => $project->tasks->filter(function ($task) {
    return $task->completed;
}),
Oct
27
3 weeks ago
Activity icon

Replied to How Can I Controller My Web Routes From Vuejs Except A Specific Prefixed Route?

What do you mean exactly "control the routes via vue.js"? I'm not really sure what you are trying to accomplish.

Oct
26
3 weeks ago
Activity icon

Replied to Route [login] Not Defined

Auth::routes() defines the default laravel authentication routes if you have them installed. There should actually be a 'login' route in there already.

And the default logic is it will redirect you to a route named "login" if you try to access a route thats protected while you are not logged in. You can check the Authenticate middleware and change that name.

Activity icon

Replied to Route [login] Not Defined

No you can't do that. Laravel looks through your routes one by one and calls the first one that matches the given URL. Everything else will be ignored. So if you rename one of them your problem should go away :)

Activity icon

Replied to Route [login] Not Defined

Your service route is protected by authentication. So if you click it and you are not authenticated it will automatically redirect you to the login page.

Oct
25
4 weeks ago
Activity icon

Replied to MAIL FROM Domain On AWS SES

You're a genius! Man... No idea why I haven't tried that before.

Activity icon

Replied to How To Get One Attribute Value Inside Of A Method

I'm not quite sure what kind of data is coming into the responseAdapter method.

Have you tried console.logging the data variable to check if data.teamLeaderOfWithDescendants exists?

Activity icon

Replied to MAIL FROM Domain On AWS SES

Only the MAIL FROM part. DKIM is verified and working. Also the emails are working but they are currently being sent from some AWS subdomain which is the default and I think that's triggering some Spam filters which is why I'd like to set the MAIL FROM domain.

I'm just not sure how to get around that problem :)

Activity icon

Replied to MAIL FROM Domain On AWS SES

Well, I changed the DNS setting also a couple weeks ago (same time as DKIM which was recognized in minutes) so I hope it's not that :D

Sure.

The TLD is baufragen.de and the FROM domain is mail.baufragen.de

Thanks!

Activity icon

Started a new Conversation MAIL FROM Domain On AWS SES

Hey,

I have a problem with AWS. I have setup a SES domain to send emails (which works flawlessly) but sometimes mails bounce because of spam. So a couple weeks ago I activated DKIM which also works great.

Now I'm trying to change the MAIL FROM domain and have setup a subdomain to use (mail.thedomain.com) and added the necessary MX and SPF records to the DNS but Amazon is not able to pick it up.

I tried a lookup with mxtoolbox.com and the values are shown there just the way it's supposed to be but the status in the AWS console doesn't change from "pending".

Any hints why this might be the case?

Cheers!

Oct
23
4 weeks ago
Activity icon

Replied to Undefined Index Error

@fortran001 Your code got truncated, can you post it again? :)

Oct
22
1 month ago
Activity icon

Replied to Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Call To Undefined Function App\Exceptions\array_get()

Is there an error message?

But I think @nakov meant Arr::get(), not Array::get() :)

Activity icon

Replied to How To Bind A Text Of A Button ?

Where does your "zipcode" variable come from? and you are passing "oldZipcode" but never use it.

Activity icon

Replied to Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No Message

You have a URL parameter {mechanic_service_station_info} in your URL but your Add() method expects $mechanic_id

Activity icon

Replied to Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Call To Undefined Function App\Exceptions\array_get()

array_get has been deprecated. If you have upgraded your Laravel version check out the upgrade guide. :)

Activity icon

Replied to Product Is Not Deleting Form Cart

Actually... I just noticed... you have a route parameter {id}, then a method parameter $product and you pass it a variable $slug.... I feel like something is not right there but I'm wondering how you get a success message from all that :)

Activity icon

Replied to Product Is Not Deleting Form Cart

What's in the $slug variable in your route() method?

Activity icon

Replied to Sass And Less

Depends strongly on the website you are building. You can optimize a lot with multiple files but it will be a lot of work and very complicated to keep track of. So the easier way is usually one big file (since that file will be cached by the browser anyway and only needs to be loaded once).

But if you have a big chunk of css code that you need only for a single page on your website you could think about moving that to an extra file and load it only on that one page.