ftiersch

ftiersch

Member Since 3 Years Ago

Experience Points 64,275
Experience Level 13

725 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 86
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

18 May
1 day ago

ftiersch left a reply on 419 Sorry, Your Session Has Expired. Please Refresh And Try Again.

I'm confused... do you get 419 or 404?

Either way... add @csrf (if you have Laravel 5.8) right after your form HTML tag.

17 May
2 days ago

ftiersch left a reply on How To Create Two Columns With @foreach?

Exactly what @vilfago says.

You probably have objects of the type "Service" in your $services array. So if you @foreach twice over that you get the title in your $service variable. And a string (title) doesn't have another variable "title".

ftiersch left a reply on How To Create Two Columns With @foreach?

I would guess your $services array doesn't have "rows" underneath it... you'll have to structure your arrays that way if you want to use two foreach loops

15 May
4 days ago

ftiersch left a reply on SQLSTATE[42S02]: Base Table Or View Not Found: 1146 Table 'mydb.users U' Doesn't Exist

The backtick is important :)

The problem is, that MySQL interprets users u literally as the tablename... so it doesn't rename your table for the query (that would be users u - see the difference?).

Either you just use "users" everywhere in your query or I think it should work with DB::raw().

->table(DB::raw('users u'))
14 May
5 days ago

ftiersch left a reply on Eloquent Query Returns A Field As Null When It Should Not Be

Probably the joined tables have a user_id column too that's null. Since every key can only be used once the latest value "wins" and overwrites the earlier ones.

So your "user_id" key will first be (for example) the 3 of your concern_user table and then administrative_points comes along and overwrites that value to null.

Use select() to select specifically which columns you need from which table.

13 May
6 days ago

ftiersch left a reply on Where I Can Save Array For Blade?

class MyController {
    public function index() {
        $myArray = ['test' => 'Hello'];

        return view('index', ['myArray' => $myArray]);
    }
}

With this you can use it with $myArray in your blade view.

ftiersch left a reply on Where Save Array For Blade?

I have no idea what you are asking.

ftiersch left a reply on Problem With Axios POST

The error isn't in the JavaScript... a 500 response code means there is an error happening on the server. Check your logs to see the error message otherwise it's only guessing...

12 May
1 week ago

ftiersch left a reply on Problem With Axios POST

The error is on your server side. Check your Laravel logs for the error message.

Try this:

return response()->json(['message' => 'task was successful']);

but not sure if that is the source of the error.

ftiersch left a reply on Chack For Input Array If It's Empty Or Not

Yes, because that's not how arrays work :)

$input['inventory'][0]['amount']

But you can use Laravel functions for that.

request()->filled('inventory.0.amount');

Should do what you need.

10 May
1 week ago

ftiersch left a reply on Use Input From One View To Print Result Into Another View

You called your variable in the array $users...

return view('userlist',['$users' => $users]);

The key needs to be 'users', then you can use $users in the blade.

ftiersch left a reply on Model Event With Multiple Parameters

Yes, for the user that's the best way :)

But be careful with events. If you handle them via a queue on a worker server the user might not actually be there in the event! Depends on your configuration and server structure :)

ftiersch left a reply on Horizontal Row, Odd Logic

Thanks for the shout out ;-)

@foreach ($users as $user)
    // display one "user" here
@endforeach

@for($i = 3 - $users->count(); $i > 0; $i--)
    // display one "space filler" here
@endfor

That should do it :) Just dynamically start the for() loop where you need it to start. If you want a different number than "3 per row" you can just change the 3 to 5 for example.

ftiersch left a reply on Method Illuminate\Support\Collection::paginate Does Not Exist

@MUNAZZIL - Man, are you even READING the questions? Your answer has nothing to do with it...

@splendidkeen What does your "meeting" method do? Did you write your own collection logic there?

09 May
1 week ago

ftiersch left a reply on Time Message Disaply But Only When I Refresh

No... I mean your VueJS code that actually sends a request to the backend

ftiersch left a reply on Time Message Disaply But Only When I Refresh

That code doesn't help unfortunately, we need the code that reacts to your messagesent event :)

ftiersch left a reply on Unexpected Token

because you concatenate strings in javascript with +, not . ;-)

You were in PHP brain :)

ftiersch left a reply on Time Message Disaply But Only When I Refresh

I think you posted the same code twice :)

But I guess you add the message instantly to the array of messages (in the code that's missing). To get the created_at you need to send it to the server first and then add the result because laravel creates that timestamp for you when it adds your message to the database.

ftiersch left a reply on How To Check If $collection Is Odd, Within The Current Pagination?

@BOBBYBOUWMANN - Ah crap, google showed me a third party page :D Thanks!

Still not the right use case here

ftiersch left a reply on How To Check If $collection Is Odd, Within The Current Pagination?

@BOBBYBOUWMANN - I didn't find anything about odd / even in the docs but also he needs it depending on the number of items in the collection, not the current "state" of the $loop variable

ftiersch left a reply on How To Check If $collection Is Odd, Within The Current Pagination?

Oooh...

// if odd
$users->count() % 2 != 0

There you go :)

ftiersch left a reply on How To Check If $collection Is Odd, Within The Current Pagination?

Okay, so I understood correctly :)

But your example in the first post should work for that. What's wrong with it?

ftiersch left a reply on How To Check If $collection Is Odd, Within The Current Pagination?

I'm not sure what you mean with every pagination link? Can you show some code there?

ftiersch left a reply on Laravel Multiple Slugs

You can just use 1 slug and then split it up into multiples. Your URL would hit your route all the same since "transport/cars" also fits into the {categories} variable. Then in your controller you can do explode("/", $slug) and get all the pieces.

ftiersch left a reply on Not Working Php Artisan Db:seed?

You can check your names :)

File: UserTableSeeds.php Class: UserTablesSeeder Call: UserTableSeeder

When you get them all aligned it should work :) If it doesn't - run composer dump-autoload

ftiersch left a reply on How To Create A Calendar To Show Archived Posts?

I don't think you need to change the structure. Here are some thoughts:

Get your posts and then go through them. For every month that exists you add a link to an array. The links in the sidebar don't have to have their own database entries so you basically only need to find out which ones to display.

That's the "hard" part - mostly to give it good performance. To improve it there are probably MYSQL functions - you could possibly transform the created_at to a month + year string and then group by that string? (I'm not that good at mysql ;-))

When you click you create a carbon object (for example) for that month and then filter your posts only for that month. So create a carbon object and get posts with created_at between [month->startOfMonth, month->endOfMonth].

ftiersch left a reply on Open Local Folder In Finder/explorer From Laravel Web App

That's not possible because it would be a security problem if your code could "manipulate" the users system like that.

ftiersch left a reply on WithCount() Returns 0

If you want the total you need to add it... The way you have it probably just sets the total number to 0 because the last one has zero :)

Here is a simpler way:

$reservations = $reservation->withCount('guestpaxes')->get();

$pax_count = $reservations->sum('guestpaxes_count');

ftiersch left a reply on Vue.js - Sending A Message

Your code got removed :) Could you add it again?

ftiersch left a reply on Get All Posts That Belong To Tags User Is Subscribed To - How?

I don't think that will work. I think hasManyThrough works on two 1:n relationships but you have multiple m:n relationships if I understand your case correctly.

ftiersch left a reply on Get All Posts That Belong To Tags User Is Subscribed To - How?

$posts = Post::whereHas('tags', function ($query) {
    $query->whereIn('id', auth()->user()->tags->pluck('id'));
})->get();

I think that should work... don't know about performance though :D

ftiersch left a reply on Select Data Which Created_at Today Error

You join two tables so you need to tell MySQL which created at you want to check... add the table name in front of it.

Either addressitems.created_at odr sales.created_at

ftiersch left a reply on Queue Not Seeing Newly Installed Package

How are you executing your queue worker? Probably it's the same version you use when you just execute a php command on your server. So you can find out there if the module is installed correctly with php -m I think.

ftiersch left a reply on Search Function MYSQL

Somewhere in your index.blade.php code you seem to use the variable $categories :)

Also:

where('name', $request->get('search'))
    ->orWhere('name', 'like', '%' . $request->get('search') . '%')

You can remove the first where since the second one will find every instance of the first one

ftiersch left a reply on Queue Not Seeing Newly Installed Package

Is your queue worker maybe using a different version of PHP and you have installed it in the wrong PHP? (like PHP cli version and fpm version)

ftiersch left a reply on Convert Any Type Of Files To Pdf

You're gonna have to limit it a little bit... or how do you suggest to convert a zip file into a PDF? ;-)

What kinds of files do you mean? Images?

08 May
1 week ago

ftiersch left a reply on What Is Query() Method For?

It's not necessary. It just gives you the current query builder object if you need to save it in a variable for example.

ftiersch left a reply on Reseed DB After A Crash

Have you tried a

composer dump-autoload

? That usually helps me with this error

ftiersch left a reply on Multiple Layers

What you need is a belongsToMany relationship I think ;-)

And then add a pivot "enabled" to it.

https://laravel.com/docs/5.8/eloquent-relationships#many-to-many

ftiersch left a reply on Model Event With Multiple Parameters

Where would those parameters come from?

You can use your event you had before and fire another event with more parameters in that event. But the eloquent events only have the model as a parameter because Eloquent can't know what other data you need.

ftiersch left a reply on Select Field Autoload LGAs From State

$("select[name='lga_id'").html('');

$("select[name='lga_id'").html(data.options);

You are missing the closing ] for the selectors here :)

ftiersch left a reply on Select Field Autoload LGAs From State

Is an AJAX Request sent to the server? Is your JS code AFTER your select tag?

ftiersch left a reply on Returning All Where Relationship Doesn't Exist

return $this->orders()->whereDoesntHave('parentOrders');

I think this should already do the trick - and you have all the benefits of normal relationships.

Haven't tried it though :)

ftiersch left a reply on The Page Has Expired Due To Inactivity.Please Refresh And Try Again This Error Comes When Login To Admin Panel

Are your cookies / sessions working properly on the server? If they don't CSRF won't work properly which leads to that error

ftiersch left a reply on TimeZone Related

You could simply use Carbon and set your timezone in config/app.php

ftiersch left a reply on Class App\Http\Controllers\Auth\Auth\ForgotPasswordController Does Not Exist

Not in the Controller... in your web.php...

Route::group(function (){
    Route::get('login', 'Auth\[email protected]')->name('login');
    Route::post('login', 'Auth\[email protected]');
    Route::post('logout', 'Auth\[email protected]')->name('logout');

    if ($options['register'] ?? true) {
        Route::get('register', 'Auth\[email protected]')->name('register');
        Route::post('register', 'Auth\[email protected]');
    }

    if ($options['reset'] ?? true) {
        Route::resetPassword();
    }

    if ($options['verify'] ?? false) {
        Route::emailVerification();
    }
});

ftiersch left a reply on Old Value For Checkbox Multiple - Laravel

Use this:

$variant->tags->pluck('id')->toArray()

ftiersch left a reply on Class App\Http\Controllers\Auth\Auth\ForgotPasswordController Does Not Exist

Auth\Auth is one Auth too much. ResetPassword sets the Auth namespace itself I guess so it's double.