CorvS

Member Since 1 Year Ago

Frankfurt

Experience Points
75,180
Total
Experience

4,820 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
86
Lessons
Completed
Best Reply Awards
103
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 16
75,180 XP
Apr
16
23 hours ago
Activity icon

Replied to Links() And Bootstrap

@lacikkaa What Laravel version are you using? Are you telling Laravel to use Bootstrap pagination?

https://laravel.com/docs/8.x/pagination#using-bootstrap

Activity icon

Awarded Best Reply on How To Generate Custom Image From Username First Letter In Laravel 8

@msaad Why reinvent the wheel? If all you want is an image with the initials (or first letter) of the username check out: https://eu.ui-avatars.com/

Activity icon

Replied to How To Generate Custom Image From Username First Letter In Laravel 8

@msaad Why reinvent the wheel? If all you want is an image with the initials (or first letter) of the username check out: https://eu.ui-avatars.com/

Apr
15
1 day ago
Activity icon

Replied to How To Get The Most Recent Data

@chron I would assume that your users table has a created_at column by default. Try renaming "created_at" to "last_message_date" or whatever.

User::addSelect(['last_message_date' => ...
Activity icon

Replied to Where Between Not Working As Expected

@theone How exactly are you using that function? Show the rest of your code please and try formatting your code using ``` at the start and end of your code block.

Activity icon

Replied to Where Between Not Working As Expected

@theone Based on your query above:

$bookings = Auth::user()->bookings()
    ->withCasts(['date' => 'date'])
    ->where('date', '>=', now())
    ->get();

That requires that you've defined the bookings relationship on your User model tho.

https://laravel.com/docs/8.x/eloquent-relationships#one-to-many

Activity icon

Replied to Where Between Not Working As Expected

@theone Actually in your case you probably want to cast the column during query time:

https://laravel.com/docs/8.x/eloquent-mutators#query-time-casting

Activity icon

Replied to Where Between Not Working As Expected

@theone

But my date is not in the prefect format

Would be helpful to know which format your date is in.

Activity icon

Replied to The GET Method Is Not Supported For This Route. Supported Methods: PATCH.

@rafaeladi You are missing @csrf inside your form. Try adding it and see if that works please.

Activity icon

Awarded Best Reply on How To Get The Key Based On Values?

@romain Is it possible that a country exists for multiple keys?

$langKey = collect($array)->filter(fn($lang) => in_array('USA', $lang))->keys()->first();
Activity icon

Replied to How To Get The Key Based On Values?

@romain Then you can add ->first() at the end to get only the single key.

Activity icon

Replied to How To Get The Most Recent Data

@chron You are missing a colon after User. It has to be double colon.

Activity icon

Replied to How To Get The Key Based On Values?

@romain Is it possible that a country exists for multiple keys?

$langKey = collect($array)->filter(fn($lang) => in_array('USA', $lang))->keys()->first();
Activity icon

Awarded Best Reply on How To Get Spattie Role Name From Construct?

@user1980 You are trying to access the authenticated user in the constructor of your controller. That's not gonna work.

Activity icon

Awarded Best Reply on Being Stuck At The Same Page While Using Post Method In A Form

Your form is inside another form.

<form role="form"> <-------------------------------------------------------- Here
    <div class="card panel-default">
        <div class="card-header">
            <h6 class="m-0 font-weight-bold text-primary">Edit</h6>
        </div>


        <form action="{{route('admin.about-post')}}" method="post">
            @csrf

            <input type="text" name="test"><br>

            <button type="submit" class="btn btn-primary">Save</button>
        </form>
    </div>
</form> <------------------------------------------------------------------- Here

Try removing that outer form and see if it works.

Activity icon

Replied to Being Stuck At The Same Page While Using Post Method In A Form

Your form is inside another form.

<form role="form"> <-------------------------------------------------------- Here
    <div class="card panel-default">
        <div class="card-header">
            <h6 class="m-0 font-weight-bold text-primary">Edit</h6>
        </div>


        <form action="{{route('admin.about-post')}}" method="post">
            @csrf

            <input type="text" name="test"><br>

            <button type="submit" class="btn btn-primary">Save</button>
        </form>
    </div>
</form> <------------------------------------------------------------------- Here

Try removing that outer form and see if it works.

Activity icon

Replied to How To Get Spattie Role Name From Construct?

@user1980 You are trying to access the authenticated user in the constructor of your controller. That's not gonna work.

Activity icon

Replied to Being Stuck At The Same Page While Using Post Method In A Form

@linda maya Is there anything that could be interfering with your form? Maybe you wrapped it inside another form or have a <a> tag somehwere that hasn't been closed properly. It would be easier to help if you could show us the complete blade file.

Activity icon

Replied to Laravel(8) Queue, Crash To Server Error 500, Because Wrong Instance.

@mikromike The error already tells you what's wrong. You are passing a collection to the constructor of your StatusOkJob class, while it expects something else. Go check your constructor.

Activity icon

Replied to User Policy. Keep Getting 403 | This Action Is Unauthorized.

@bobzamin Please try replacing the parameter of your show function inside your controller:

public function show(User $model) <-- Here
{
    return view('view-user');
}
Activity icon

Replied to User Policy. Keep Getting 403 | This Action Is Unauthorized.

@bobzamin How is that any different than before when you are still using ->middleware('can:view,App\Models\User')?

Activity icon

Replied to User Policy. Keep Getting 403 | This Action Is Unauthorized.

@bobzamin It has to be ->middleware('can:view,model').

Activity icon

Replied to Using $message->embed Outside The Mail Blade

@pokhrelashok2 How exactly are you replacing your constants? You could simply replace the [IMAGE] constant with the appropriate HTML snippet.

<img src="{{ $message->embed($pathToImage) }}">

And render the unescaped HTML code using {!! $image !!} for example.

https://laravel.com/docs/8.x/mail#inline-attachments

https://laravel.com/docs/8.x/blade#displaying-unescaped-data

Apr
14
2 days ago
Activity icon

Replied to How To Get The Most Recent Data

@chron If you are eager loading the messages relationship it's always going to be a collection of messages. If you only want the latest message you could work with a dynamic relationship:

https://reinink.ca/articles/dynamic-relationships-in-laravel-using-subqueries

Activity icon

Replied to How To Get The Most Recent Data

@chron What do you mean? It's empty because that particular user hasn't sent any messages yet.

Activity icon

Replied to How To Show Random Client Logos In Laravel

@dipherent Glad it worked out.

I assumed that when I used inRandomOrder I would only get the unique ones each time... I am thinking that inRandomOrder only randomize the order, not the values... right?

Right, it randomizes the order of your clients, but each client is unique by default anyway (in the sense that they have unique IDs).

Activity icon

Awarded Best Reply on How To Show Random Client Logos In Laravel

@dipherent The same logo on the same page twice means that two different clients have the same logo. It has nothing to do with your randomness not working.

How did you create the clients and their logos? Using a factory?

Activity icon

Replied to How To Show Random Client Logos In Laravel

@dipherent The same logo on the same page twice means that two different clients have the same logo. It has nothing to do with your randomness not working.

How did you create the clients and their logos? Using a factory?

Activity icon

Replied to How To Show Random Client Logos In Laravel

@dipherent It depends how many clients you have. If there are only 20 clients the probability that the same client is selected in consecutive requests is pretty high.

but this sometimes get the same logo twice ..

Do you mean on the same page or after refresh?

Activity icon

Replied to Scheduled Task Not Running As Expected

@requincreative Have you tried running the student task using daily() (without specifying the time)? Simply to check if it's maybe related to the task and not the scheduler.

Did you check if scheduling works in general? Especially for that time.

Activity icon

Replied to Can't Change Password . Password Not Match .

@desssha So you are saying that Hash::check doesn't return true, even so the passwords are the same? Are you sure, that the password is correct? Did you make any changes to your database like changing the encoding? Or did you make any changes to your hashing config?

Activity icon

Awarded Best Reply on Need Registered Users To Fill Out Form First

@t0ne Yes, that would be one way to do it. Are your users allowed to change that data afterwards? If yes, you'd have to consider that a user can delete data needed for a completed profile and revoke the "completed" status.

Alternatively you could require all the data during registration, so that the user is only allowed to register when providing all necessary data. Depending on your use case, that could result in a major drop in conversion rates tho.

Activity icon

Replied to Need Registered Users To Fill Out Form First

@t0ne Since you want to prevent them from using the app in general a middleware makes the most sense for sure. If only certain endpoints shouldn't be accessible you could work with a "TeamOwner" policy instead.

Activity icon

Replied to Need Registered Users To Fill Out Form First

@t0ne Yes, if a completed profile is only required for certain users/roles it would make more sense to either use a separate table for that (maybe polymorphic) or you add that "completed" timestamp to the specific table (e.g. team_owners).

Activity icon

Awarded Best Reply on Laravel Language Switcher

@ajaxtest What exactly? Since I don't know what you are trying to achieve I am unable to help. If you set the locale as described above, the locale is changed for that request. So if you want the locale to be applied to all future requests (after using the language switch) you'd have to store the selected locale in the session and work with a middleware, which sets the locale to the value stored inside the session.

Activity icon

Replied to Laravel Language Switcher

@ajaxtest Okay, then you probably want to store the locale inside the session when the user changed his preference and work with a middleware as described above or rather add a middleware that sets the locale to the user's preferred locale.

Activity icon

Replied to Need Registered Users To Fill Out Form First

@t0ne Yes, that would be one way to do it. Are your users allowed to change that data afterwards? If yes, you'd have to consider that a user can delete data needed for a completed profile and revoke the "completed" status.

Alternatively you could require all the data during registration, so that the user is only allowed to register when providing all necessary data. Depending on your use case, that could result in a major drop in conversion rates tho.

Activity icon

Replied to Laravel Language Switcher

@ajaxtest What exactly? Since I don't know what you are trying to achieve I am unable to help. If you set the locale as described above, the locale is changed for that request. So if you want the locale to be applied to all future requests (after using the language switch) you'd have to store the selected locale in the session and work with a middleware, which sets the locale to the value stored inside the session.

Activity icon

Replied to A Mutator To Get File Extension

@maltekiefer You are referencing a filename property, but your $fillable array only has name and file_path. Does that column even exist?

Activity icon

Awarded Best Reply on API With Laravel Sanctum?

@foks Have you tried using the auth:sanctum middleware instead?

Activity icon

Replied to API With Laravel Sanctum?

@foks Have you tried using the auth:sanctum middleware instead?

Activity icon

Replied to API With Laravel Sanctum?

@foks What Laravel version are you using? Seems like an older project to me, since the api_token is expected on the User model directly.

https://laravel.com/docs/5.8/api-authentication#database-preparation

Activity icon

Replied to How To Modify Spatie Role And Permission?

@anonymouse703 Not sure what you mean. Care to elaborate?

Activity icon

Replied to Laravel Language Switcher

@ajaxtest Same thing. Simply use App::setLocale($yourLocale);.

Activity icon

Replied to API With Laravel Sanctum?

@foks Did you follow the installation instructions step by step?

https://laravel.com/docs/8.x/sanctum#installation

And how exactly are you "testing" the API?

Activity icon

Replied to API With Laravel Sanctum?

@foks Did you change the default Sanctum configuration? Your error says that a api_token column is expected on the users table. By default Sanctum creates a separate table for API tokens. Did you add the HasApiTokens trait to your User model?

Activity icon

Replied to Laravel Eloquent Sorting Through Parent-child Relationship

@erron You have to use a join in order to achieve what you want. Right now you are simply ordering the departments and since there is only one for each user nothing happens.