ftiersch

Member Since 5 Years Ago

Experience Points
132,805
Total
Experience

2,195 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
196
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 27
132,805 XP
Feb
26
2 days ago
Activity icon

Replied to How To Access Helper Method In Laravel By Vuejs

You cannot access a PHP method in VueJS... One runs on the server, one runs in the browser.

Either you pass data from Laravel into your blade and then pass it to VueJS or you can get data from the server via an AJAX call.

Activity icon

Replied to Notify Users That A New Post Has Been Published

$users = User::whereHas('categories')->with(['categories' => $callback])
        ->where('email_updates', 1)->get();

You have to put the category condition into the "whereHas" too :) Right now you're saying "give me users that have categories. And for those user also load the categories with this specific condition".

$users = User::whereHas('categories', function ($query) use ($topicCategory) { $query->where('id', $topicCategory); })->with(['categories' => $callback])
        ->where('email_updates', 1)->get();
Feb
25
3 days ago
Activity icon

Awarded Best Reply on Is It A Good Practice To Add Custom Verbs To Policies?

Of course that's no problem. The base logic only adds the base functionality - CRUD. But your business logic probably has more besides that in order to create value for your customers so you also need to extend the available base functionality.

Activity icon

Replied to How To Update Specific Filed According To A Condition?

Just move the array out of the method call.

$newData = [
	'company_name' => $request['company_name'],
	...
];

if (!empty($imageName)) {
	$newData['company_logo'] = $imageName;
}

Company::find($id)->update($newData);
Activity icon

Replied to Is It A Good Practice To Add Custom Verbs To Policies?

Of course that's no problem. The base logic only adds the base functionality - CRUD. But your business logic probably has more besides that in order to create value for your customers so you also need to extend the available base functionality.

Feb
24
4 days ago
Activity icon

Replied to Unexpected Redirect To Login

Sounds like you lose your session somewhere in between the requests. What session driver do you use? Do you have a session()->flush() somewhere in a middleware maybe?

Activity icon

Replied to Help With Unique User Id

You mean randomly instead of just counting up?

Activity icon

Replied to How To Become A Professional Laravel Developer

Technically? Find someone who pays you to develop something with Laravel for them. That's the definition of "professional".

But I guess you mean a "good" developer?

Exactly as @chaudigv said. Practise and don't get discouraged. Create a hobby project for yourself to see what it's about and what things you can use.

Activity icon

Replied to Retrieving A Loaded Relationship But Do Not Hit Database If Missing

relationLoaded shouldn't actually hit the DB. Are you sure about that one, that the DB Query comes from this part?

Feb
23
5 days ago
Activity icon

Replied to All Properties Of The $request Are A String Type !

https://laracasts.com/discuss/channels/general-discussion/handling-formdata-null-string

That should be the same problem :) The problem is FormData and axios, not on the Laravel side.

Activity icon

Awarded Best Reply on Similar Question: Trying To Get Property 'p_name' Of Non-object

hasMany returns a collection of items, not a single item. And a collection doesn't have the "p_name" attribute. You need to select a specific product from that collection or use a different kind of relationship (hasOne for example).

Activity icon

Replied to Similar Question: Trying To Get Property 'p_name' Of Non-object

hasMany returns a collection of items, not a single item. And a collection doesn't have the "p_name" attribute. You need to select a specific product from that collection or use a different kind of relationship (hasOne for example).

Feb
22
6 days ago
Activity icon

Replied to Return Redirect() Doesn't Redirect To Desired Page

You should check out the internal Laravel validation system :) It does exactly what you need (I think) and makes your controller a lot easier to read and understand. And for custom logic you can also create your own rules to validate a value.

Activity icon

Awarded Best Reply on Return Redirect() Doesn't Redirect To Desired Page

You return a redirect from another method. If you want to stop the flow you need to return from your controllermethod too. Otherwise you return the redirect but it just vanishes since you don't save it anywhere

Activity icon

Replied to Return Redirect() Doesn't Redirect To Desired Page

You return a redirect from another method. If you want to stop the flow you need to return from your controllermethod too. Otherwise you return the redirect but it just vanishes since you don't save it anywhere

Feb
20
1 week ago
Activity icon

Replied to Mail Markdown Messages - Invalid Argument Supplied For Foreach()

Hahaha, happens to everybody! I've spent many hours before to find that comma that shouldn't be there etc :)

Activity icon

Awarded Best Reply on Mail Markdown Messages - Invalid Argument Supplied For Foreach()

$this->$services = $services;

You have an $ after your -> :)

Activity icon

Replied to How To Get The Last Data Of The Day For A Week

You mean something like this?

Data::whereBetween('created_at', [now()->subWeek()->startOfDay(), now()->subWeek()->endOfDay()])->orderBy('created_at', 'DESC')->first();

This would give you only the data from the same day last week (so on thursday it would give you last weeks data from thursday), order that by date descending (so the latest would come first) and then returns the first one (so the latest one).

Activity icon

Replied to Mail Markdown Messages - Invalid Argument Supplied For Foreach()

I think public attributes of the Mailable are by default accessible inside the view if I remember correctly.

Activity icon

Replied to Testing The Relationship Opun Creating A Model In Laravel

If your database is empty during tests you can just check if there is one row inside your user_vendor table after executing the call.

Otherwise you can just get the user from the database with Eloquent like you usually would. It's the same database in your test and your controller :)

Activity icon

Replied to Mail Markdown Messages - Invalid Argument Supplied For Foreach()

$this->$services = $services;

You have an $ after your -> :)

Feb
19
1 week ago
Activity icon

Awarded Best Reply on How Can I Pass Get() Link In Laravel Controller

You mean you need to send a request to that URL? You can use something like Guzzle to send requests but the "get" function doesn't exist in PHP.

Activity icon

Replied to How Can I Pass Get() Link In Laravel Controller

You mean you need to send a request to that URL? You can use something like Guzzle to send requests but the "get" function doesn't exist in PHP.

Feb
16
1 week ago
Activity icon

Replied to Larastan / Double ?>

True, that can definitely be a bitch :D Unfortunately I don't know a tool / solution that can do it already

Activity icon

Replied to How To Merge Array

array_merge_recursive should do the trick I think

Activity icon

Replied to Laravel- Blade How To Output HTML Tag In Double Curly Braces?

Use unfiltered output if you're sure about the source:

{!! !!}
Activity icon

Replied to Larastan / Double ?>

It's not necessarily a bug since all you're saying is "alrighty, PHP stops here, everything from here on out is HTML". So you would probably have a random "?>" show up on your page somewhere

Feb
15
1 week ago
Activity icon

Replied to Production Server Frequently Facing Memory Issue.

PHP has memory on a "per request" basis... So just because your user is logged in and does stuff doesn't mean he / she is piling on memory because the garbage collector usually cleans it up in between. Same with images - while uploading they will be saved on the hard disk but you might have them in memory if you do other stuff for a short time (like resizing etc).

I've had a similar problem and saw that there is a php option if you are using php-fpm. See this thread: https://stackoverflow.com/questions/29608292/what-is-pm-max-children-and-pm-max-requests

Basically it says after how many requests a PHP process should be killed (and restarted) which would free up all the memory. I didn't have a value there so it would just sloooowly creep up bit by bit until it crashed. Currently I have a value of 500 in there (i think).

Activity icon

Replied to Counting Amount Of Products In Category Not Working In Laravel

First of all: Don't declare functions in blade!

Second:

Of course it can be done. Problem might more be "How to do it with good performance" ;-)

Multiple ways I could think of:

  1. Write logic, that calculates the number of products "on the fly" (so live, as soon as you need it). This might be the most dynamic but of course also the most performance costly. Maybe in your usecase it's possible to use some caching here and cache the result for a couple of minutes to reduce the load.

  2. Save the number of products for each category in the database. Then there is the question of when to update that number. One possibility would be to update it every time a product is added / removed / changes categories. This would probably perform a lot better but it might be easier to product bugs if you forget to call that update method somewhere.

Activity icon

Replied to Class 'Hexters\CoinPayment\CoinPayment' Not Found

Have you tried

composer dump-autoload

?

Activity icon

Replied to Accessor Not Working

What is happening instead? Do you still get 1 / 0 as value?

And can you show where you are using it?

Feb
10
2 weeks ago
Activity icon

Replied to Sort Posts With "Featured" Posts First

I'm not sure what your question is exactly?

If you have a simple field in the database I would order it in the database, so simply use two "orderBy" clauses.

Feb
04
3 weeks ago
Activity icon

Replied to Undefined Index: Questionid

Don't use $_POST... use the laravel tools.

request('questionid')

For example like that.

Activity icon

Replied to How To Allow Users Post Annoymous

Add a column "is_anonymous" to your posts table and when you output the username check for that column. If it's true -> display anonymous... otherwise display username.

Activity icon

Awarded Best Reply on Prebuilt Software Solution

That is exactly the point of Laravel... It brings a lot of commonly used functionality to the table and a lot of other functionality can be added with packages (also lots of "official" Laravel packages by the Laravel team).

Feb
03
3 weeks ago
Activity icon

Replied to General Error: 1364 Field 'name' Doesn't Have A Default Value

Although... apparently nothing is added to the query so that shouldn't be it since your password is hardcoded in the factory.

Do you maybe have another factory that accidentally has the User::class as a model?

Activity icon

Replied to General Error: 1364 Field 'name' Doesn't Have A Default Value

I think the faker "name" is an attribute, not a method (though it might be both - just jumped out at me :)).

So $this->faker->name,

Jan
30
4 weeks ago
Activity icon

Replied to View In Browser Link For Emails

I have most certainly not and I'm now very embarassed about it! That sounds like a great solution, thank you :D

Activity icon

Started a new Conversation View In Browser Link For Emails

Hey,

I'm currently working on some emails in a project (daily, weekly summaries of what has happened, stuff like that) and am thinking about how to best implement a "View this email in browser" link there in case the users have an old email program or just get text emails.

I know the "rendering a mailable as view" feature so that part is not my question. But I'm a little stumped about how to implement the - let's call it "state".

For example the daily summary summarizes changes that happened since the last reminder in the last 24hours (duh). So the email is created quite dynamically with those changes and I need the dynamic data of that email somewhere (since it's different for every user).

My thoughts so far were:

  1. Save the rendered email as HTML in the database and display that
  2. Try to save the "dynamic" data as JSON in the database so I can rebuild the email from that.

But number 1 would bloat the DB quite a bit and number 2 is a very big development and maintenance overhead.

Has anyone ever implemented a feature like that and could share some learnings?

Thank you

Jan
25
1 month ago
Activity icon

Replied to Http 500 Error When I Try Post Request

The method is called "Route::post" (small letters) but not sure if that would be the problem. Can you check the log file for the actual error message? (or turn on APP_DEBUG=true in the .env file and check the result of the POST request)

Jan
18
1 month ago
Activity icon

Replied to VUE Is Regret.

How about you show a project with jquery first? ;)

We don't need to convince you here... if you don't want to use it - use something else. It's that easy.

Jan
12
1 month ago
Activity icon

Replied to Laravel Eloquent-relationships

Is your user logged in?

Activity icon

Awarded Best Reply on Symfony\Component\Routing\Exception\RouteNotFoundException

If you use redirect()->route() you need to pass the name of the route, not the actual URL... try redirect()->to($link) (I think, maybe it's url())

Activity icon

Replied to Symfony\Component\Routing\Exception\RouteNotFoundException

If you use redirect()->route() you need to pass the name of the route, not the actual URL... try redirect()->to($link) (I think, maybe it's url())

Activity icon

Replied to Split Seeder Into Multiple Seeders - Same Table

You can do whatever you want in a seeder. It's only a class that gets called, all the logic comes from you.

You could have a CitiesGermanySeeder and a CitiesFranceSeeder (for example) and then have a CitySeeder class that calls the other two...

Jan
11
1 month ago
Activity icon

Awarded Best Reply on TDD :Error: Call To Undefined Method Tests\Feature\ProjectTasksTest::signIn()

You called your method "singIn"

Activity icon

Replied to Counting The Active Jobs Only With Jobs_count From Another Table

maybe orderBy('active_jobs_count'...)?

Activity icon

Awarded Best Reply on Target Class [Illuminate\Auth\Middleware\adminpermission] Does Not Exist.

You need to use the correct namespace for your middleware. Hopefully you haven't created the adminpermission file in the vendor folder? So your namespace can't start with Illuminate\ :)

Activity icon

Replied to Target Class [Illuminate\Auth\Middleware\adminpermission] Does Not Exist.

You need to use the correct namespace for your middleware. Hopefully you haven't created the adminpermission file in the vendor folder? So your namespace can't start with Illuminate\ :)