ftiersch

ftiersch

Member Since 4 Years Ago

Experience Points 86,655
Experience Level 18

3,345 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 122
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.

16 Sep
11 hours ago

ftiersch left a reply on Undefined Index

What does it say if you do

dd($data); 

after you got your data from the request?

ftiersch left a reply on User Model Namespace Not Importing

You cannot extend from multiple classes. Authenticatable already extends Model so you don't need to extend from it yourself.

ftiersch left a reply on Convert 'DD/MM/YYYY' Format To Timestamp

Of course it has... But things like Carbon and Collections just put an easier to use API wrapper around ootb things :)

ftiersch left a reply on How To Convert Date To Datetime ?

Maybe createFromFormat works better:

Carbon::createFromFormat('d/m/Y', $request->get('begin'))

ftiersch left a reply on How To Convert Date To Datetime ?

$date = '10/03/2019';

Carbon::parse($date)->toDatetimeString();

ftiersch left a reply on How Can I Check How Much Database Connection Dynamically

You get a normal php array back. So with @tykus method you get all the names as a new array. Or you go through them with foreach()

ftiersch left a reply on Limited Array Length And Key Size

You mean you send it TO your view? Can you show more code?

ftiersch left a reply on Upload Image Overwrite EXIF Metadata

http://image.intervention.io/api/exif

Have you seen the part about php being combiled with --enable-exif?

ftiersch left a reply on Limited Array Length And Key Size

Are all the keys unique?

array[test] = 10;
array[test] = 20;

This would only arrive as array[test] = 20 because the second value overwrites the first one.

ftiersch left a reply on How Can I Check How Much Database Connection Dynamically

count(config('database.connections'))
15 Sep
1 day ago

ftiersch left a reply on Should I Write A Test For Each Model Which Have Polymorphic Relationship?

I'd say it depends on your code around it. You usually don't need to test basic Eloquent functionality - the Laravel team has tests for that. But if you have certain functionality around it you can definitely test that.

Also depends of course on how "sure" you want to be :) If you think "well, if it works for video it should work for threads" thats fine. If you want to be absolutely sure you can write a test.

ftiersch left a reply on Exist Validation In Update On User's Input

Okay... what's the question / error / behaviour?

14 Sep
2 days ago

ftiersch left a reply on My Factory Is Not Applied To My Test Cases

And your User class has a "verified" column? Is the verified column filled in the database when you execute the factory?

ftiersch left a reply on My Factory Is Not Applied To My Test Cases

Where is your UserFactory file located? In database/factories?

ftiersch left a reply on Route SLUG On Main Route?

Yeah, simply switch the definition of your routes :) Always put the route with the parameter last in your routes file.

Laravel always uses the first route it finds that matches the current url. So in your case it matches the page because that matches everything.

12 Sep
4 days ago

ftiersch left a reply on I Need Some One Explain For Me Phpunit.xml Vs .env

That's what I meant in the first post.

If you overwrite variables in your phpunit.xml it uses those values. If you don't it uses the values in your .env file or environment variables if you have them set on your machine. Otherwise maybe there is a default value in your config files.

ftiersch left a reply on I Need Some One Explain For Me Phpunit.xml Vs .env

Sorry, I don't understand what you mean. Are your tests using the wrong database or what is happening?

ftiersch left a reply on I Need Some One Explain For Me Phpunit.xml Vs .env

What do you mean nothing happens? How do you run your tests? Have you written tests?

ftiersch left a reply on I Need Some One Explain For Me Phpunit.xml Vs .env

phpunit.xml is the file where you can set up your phpunit. So everything in there is ONLY valid for while you are running your tests.

.env are variables that you can set that have to change from environment to environment. For example on your local machine your database username would probably be different than the one on your production machine. Those values would also be available during phpunit testing but if you have the same variables in .env and in phpunit.xml phpunit will take the one from phpunit.xml

ftiersch left a reply on Laravel Upgrade 5.1 To 5.5

Laravel 5.3 introduced the new structure I think. But it all depends on your settings in the RouteServiceProvider

ftiersch left a reply on I Upgrade From 5.6 To 5.7 Then All My Api Not Working

Aah... okay...

In that case just remove the \ from your original one :)

'namespace' => 'API'

ftiersch left a reply on I Upgrade From 5.6 To 5.7 Then All My Api Not Working

In which directory is your HintsApiController? Because it looks like you need to change

'namespace' => '\API'

to

'namespace' => 'App\Http\Controllers\API'

ftiersch left a reply on Laravel 6.0 Why We Are Using Vuejs Please Tell Me What Is Internally Benefit.

Because it's a great tool that makes life easier. But you don't have to use it - you can also use React or Angular or just VanillaJS. VueJS is just the default that comes "prepared" with laravel.

ftiersch left a reply on Data Can't Update

So your URL needs to be http://localhost/new/public/exam/level/21/3 ...

Either you fix your local hosting so you only have http://localhost and then use a url starting with a / or you use an absolute url like this:

'http://localhost/new/public/exam/level/' + id + '/' + level

ftiersch left a reply on Data Can't Update

Yes, as you can see the URL that is used is wrong probably. What would the correct URL look like?

ftiersch left a reply on Data Can't Update

But you don't use a particular user id. You have a lot of hidden fields with the id "uid" and just fetch the first one of them.

And you still have a relative url.

Try this:

"/exam/level/"+ id + "/" + level

ftiersch left a reply on Data Can't Update

  1. Why are you having a foreach loop with users if you only need one user?
  2. What is the actual URL the AJAX is calling? Maybe it's because you use a relative URL in this:
"level/"+ id + "/" + level

ftiersch left a reply on Module Not Found

Also important (if you are working on Windows): Windows doesn't care about case sensitivity. So it would work with Authlayout.vue. Linux does care, though, so that won't work!

ftiersch left a reply on Module Not Found

Obvious questions first:

  1. Is there a resources/js/components/layouts/AuthLayout.vue file in your Laravel project?
  2. Is that file commited to git?

ftiersch left a reply on Sorting A Foreach Loop In Blade With Relationship Data

sortBy works a little different than in JS I think :) It doesn't actually change the original collection but returns a new collection. So you could do this:

$invoices = Invoice::where('course_occasion_id', $courseOccasionId)->get()->sortBy(function ($invoice) {
    return $invoice->user->companies_title;
});

ftiersch left a reply on Sorting A Foreach Loop In Blade With Relationship Data

You could use it in the blade but it wouldn't be very easily readable. I'd put it in the controller and then pass the sorted $invoices collection to the blade so there you only need to do

@foreach ($invoices as $invoice)

ftiersch left a reply on Type Hint Validation ?

Laravel will automatically escape those values so they can't be used to execute harmful code in your database. That is only true while you use Eloquent though so if you write your own queries you definitely need to validate those inputs!

But you need to take care of "error handling"... So if a user enters a value of "test" (which will probably not be a UserID in your database :)) you need to handle how to respond if a user with that value isn't found.

ftiersch left a reply on Sorting A Foreach Loop In Blade With Relationship Data

Sorry @fichby but your solution doesn't make sense on multiple levels.

@sandracarlsen

You can give a callback function to the sortBy method so it will be sorted by the result of that function.

$invoices->sortBy(function ($invoice) {
    return $invoice->user->companies_title;
});

ftiersch left a reply on How To Name The Table When It's 'composed Name'

You can name your tables however you like, you just have to setup your Eloquent models correctly.

Set the $table property on the model and set the second parameter on your belongsToMany() relationship to change the default table names.

ftiersch left a reply on After First Message Broadcast Show Error This.messages.push Is Not A Function

this.messages = response.data;

Probably what comes back here is not an array. Have you tried console.logging the response? If it's an object it doesn't have a push method.

ftiersch left a reply on Error

You are returning a "webPayNormal" object which apparently doesn't have a __toString implementation.

ftiersch left a reply on OrderBy() Not Compatible With Distinct()

I think you confused sortBy with orderBy. SortBy sorts a collection, orderBy sorts a query at the database level.

At least I think so. Maybe they added sortBy as an alias for orderBy but try that first :)

ftiersch left a reply on Using Multiple CSS File On Vue.

Do you have a question? Is this a tip? What are you trying to say?

ftiersch left a reply on How To Use Cron In Laravel

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

Yes you need to install a cronjob that calls the scheduler every minute. Then you can determine when your commands are run in your Kernel.php

11 Sep
5 days ago

ftiersch left a reply on Migrate: Cannot Declare Class , Because The Name Is Already In Use

Then there is something strange in your local environment. Because you should have the same problem there.

ftiersch left a reply on Migrate: Cannot Declare Class , Because The Name Is Already In Use

You have to change the filename and the class name. They have to fit together. But then you can change it and reexecute it, yes. But make sure to change the one that isn't executed yet (if the code is in production already :))

ftiersch left a reply on Duplicate Key In Table

Can you show your migration? I think you might have an error in there.

$table->foreign('customer_id')->references('id')->on('users');
$table->foreign('shipper_id')->references('id')->on('users');

This would create the foreign keys.

ftiersch left a reply on Tweaking Old Migrations

  1. They would probably WORK but they will not be RUN again (except if you have changed the name of the file / migration. In that case Laravel wouldn't recognize that it has run these again).

  2. Same as 1, as long as you haven't changed a filename there won't be a problem. Just look into your database in the migrations table, there you can see all migrations that have been run already. Every file that's not in there will be run automatically.

  3. Depends on why the migration breaks. If the migration itself breaks because of a database upgrade or something I would fix the old migration so it works. If I want to change the structure of the database in any way I always create a new migration as soon as the project has been deployed to production once.

ftiersch left a reply on Meta Tags And Other Seo Features

You just add them in your blade files. They are normal HTML tags.

10 Sep
6 days ago

ftiersch left a reply on How To Add Css Inside {{ }}

Yeah, because there is no string... Are you even putting that in a style tag?! Do you know how HTML and CSS works?

Just put out two elements...

<span>{{ $event->event }} <span style="padding: 20px;">{{ $event->when }}</span></span>

ftiersch left a reply on How To Add Css Inside {{ }}

{{ 'left-padding: 10px;' }}

But why would you want that?

ftiersch left a reply on Do You Use Laradock Instead Wampserver Or Xampp?

I'm working on windows and also using a custom docker implementation since my projects don't differ greatly.

ftiersch left a reply on Does Setting A Model Property To The Same Value Trigger An Event Oberserver

Yes because it triggers an UPDATE query in the database and also changes the updated_at column.

ftiersch left a reply on Eloquent Models

First of all in your @foreach you want to use $author->books, not $author->books()

Then you want to show which combination? Only for the currently logged in user, right?

So you would need to get the relationship between User #5 (if that user is logged in) and the $book in your foreach loop and get the pivot values of that single relationship.

Or am I misunderstanding?