ftiersch

ftiersch

Member Since 3 Years Ago

Experience Points 68,435
Experience Level 14

1,565 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 93
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.

10 Jun
1 month ago

ftiersch left a reply on Auth Login Shows 419 Page Expired On POST Request

  1. Does it work if you comment out the VerifyCsrf middleware in the Kernel.php?
  2. If yes, do your sessions work properly? CSRF saves the token in the session so if they don't work it won't find the token to compare. What sessiondriver are you using?
08 Jun
1 month ago

ftiersch left a reply on Message Module Between 3 Users

You have a table "messages" with

  • id
  • from_user_id
  • to_user_id
  • message
  • created_at

and a view where you display all the messages ordered by "created_at". Depending if the "from_user_id" is the same ID as the user that is logged in you can then give it a different color for example to make it clear which message belongs to who (like in whatsapp or other messengers).

ftiersch left a reply on Message Module Between 3 Users

Sure, easy:

  1. Fix all bugs you encounter
  2. Program any new feature you need

That's about all the help you need with the information available.

07 Jun
1 month ago

ftiersch left a reply on Update Avatar Path

  1. You validate for a field called "avatar" which doesn't exist. Also you're using request()->file('avatar').
  2. name="image/*" doesn't make sense. I'm not sure which name the browser will use.

ftiersch left a reply on Update Avatar Path

Probably because your field is called "avatar" but you check for "avatar_path" ;-)

ftiersch left a reply on Can I Make This API More Secure ?

@MOUKBEL - If you want to send it via AJAX you can send a header with the CSRF token. I think the header is called X-CSRF-TOKEN and works exactly the same way as csrf_field :)

ftiersch left a reply on Update User

Oh yeah...

! request()->input('password') === ''
request()->input('password') !== ''

Second one makes more sense :) Or even better:

request()->filled('password')
06 Jun
1 month ago

ftiersch left a reply on Update User

You'll have to decide which way you want to use... update() or save() :)

How about something like this:

$user->fill(request()->except('password'));

    if (! request()->input('password') === '')
        {
            $user->password = bcrypt(request()->input('password'));
        }
$user->save();

ftiersch left a reply on How Can The User Order A Category Of Drugs?

I don't really understand what you want to achieve or what your problem is.

ftiersch left a reply on Can I Make This API More Secure ?

Exactly what @tray2 is saying. It's good that you care about security but that's the whole purpose of HTTPS so no one can intercept the communication and read it.

Otherwise you would have to encode the whole thing in JavaScript. But since your JavaScript is per definition readable from the browser a hacker can still read it.

ftiersch left a reply on ReferenceError: DisplayBoxes Is Not Defined

I think the "displayBoxes is not defined" error could be because the select fires an onchange event for the "initializiation". So basically it fires that event right away but you add the script file only afterwards which means at the moment of the event the function is not there yet.

Try adding the script.js in the head of your HTML or add the onchange event listener in the JavaScript after the function has been defined.

ftiersch left a reply on ReferenceError: DisplayBoxes Is Not Defined

Where are you adding the script.js file to your code? in the HEAD tag or somewhere else?

ftiersch left a reply on Can I Make This API More Secure ?

First my question:

Why are you encoding the data?

04 Jun
1 month ago

ftiersch left a reply on Unable To Prepare Route [{any}] For Serialization.

You cannot cache routes with closure functions. So your caching fails -> you still have the old version of your routes in the cache -> the new route doesn't exist and throws a 404 :)

ftiersch left a reply on Error In Creating Table With Foreign Key Constrain In Migration

Foreign Key fields need to have exactly the same format as the columns they reference. So if you use bigIncrements in your add_years table you need to use a bigInteger for your year_id.

ftiersch left a reply on Force Redirect To Profile Page If Profile Is Not Completed, Laravel-5.8

Write a middleware where (if user is logged in) you check the percentage. If it's below 100 redirect the user to the desired page. Add that middleware to every route except for "edit_profile".

03 Jun
1 month ago

ftiersch left a reply on Adsense Code On Blade Template

Blade just renders to normal HTML...

  1. Have you added script tags around it?
  2. Have you included the rest of the ads library?
23 May
1 month ago

ftiersch left a reply on Relation Not Working

What's the name of your tables? One time you use "Purchases", one time "purchases". Is that the problem?

ftiersch left a reply on Edit Blade View

Yes, you get that error message because you are still using $share->id inside of your commented out code. Making an HTML comment out of it doesn't stop the PHP functionality from being executed. Remove the whole comment.

22 May
1 month ago

ftiersch left a reply on Proper Way To Check For Existance Of HTTP Header

Where are you checking that? The $request variable shouldn't be null... except of course you're not checking it during a request but during something like a worker call or an artisan command

ftiersch left a reply on How To Cast A Model To Different Model Based On Field

I don't think that quite exists... But what I could think of would be fill()... So something like:

$food = App\Food::find($id);

$specificFood = new $food->class;
$specificFood->fill($food->all());

(not quite sure if "all" works on models but I'm sure there is a method that gives you an array of all attributes :))

ftiersch left a reply on Auth::user() Not Returning All Elements

I wouldn't look for the error in the javascript if it's not there, but in the User model :) Do you have the $hidden property set?

ftiersch left a reply on Edit Blade View

First you have to add a parameter to your edit URL

Route::get('edit/{id}', '[email protected]');

Second you have to limit the URL you get in your controller

public function edit(Request $request, $id)

    {
       
        $shares = Url::findOrFail($id);

Third maybe you have to change your route() call

{{ route('shares.edit', ['id' => $share->id]) }}

ftiersch left a reply on Laravel Authentication Using Form Request Instead Of Array Validation.

The formrequest returns a rules array...

Why not just this:

return Validator::make($data, app(StoreUser::class)->rules());

ftiersch left a reply on Associative Array In Console, But Not In View

You have to convert it to JSON... right now it literally says [object Object] there :)

{{ json_encode($clients) }}

ftiersch left a reply on WhereHas In Advanced LeftJoin

Either you program the function that whereHas does yourself (which is a subselect) or you use another join to add another where condition. Probably your documents have a connection to "category" so basically you just add another join that adds that connection and then you can have your "where('category.type', 'revenue')" condition

ftiersch left a reply on WhereHas In Advanced LeftJoin

whereHas only works for Models, joining works on tables. So what Eloquent does is use the where syntax because it thinks you want to check for the column "has" (like you could do wherePrice(10) to check the "price" column).

So if you need to use a join instead of a whereHas in your original query you need to put that where differently and cannot use whereHas.

ftiersch left a reply on Laravel AWS, Setting Up PhpMyAdmin Issue

@TECHGURU - To be honest I haven't used phpmyadmin in years. Usually I use something like HeidiSQL (or SequelPro if you are on a Mac) and then connect to the database through an SSH tunnel for security reasons.

But if you make sure that your phpmyadmin is password secured I don't see a problem with it.

ftiersch left a reply on Help With Shirt -> Colors -> Sizes Laravel Relationship

You need more than one relationship for that.

First relationship is POSSIBLE SIZES / COLORS for a shirt (and probably even the combination of both). So "this shirt is available in red (S, M, L), blue (M, L, XL)" and so on...

Second thing (I'm gonna assume it's about an online shop) is the choice a user made. So user X chose shirt 15 in green with size XXXXL (probably a customer from USA ;-)). That's a second relationship you need (something like a cart).

ftiersch left a reply on Laravel AWS, Setting Up PhpMyAdmin Issue

If you have set your document root to be in /my_project/public the webserver starts looking there for your subfolders (that's why it's called "root"). So either you need to put your phpmyadmin into your public directory or you need a vhost for phpmyadmin with a different root directory.

18 May
1 month 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
1 month 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
2 months 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
2 months 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
2 months 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
2 months 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
2 months 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
2 months 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