MadMaks

MadMaks

Member Since 3 Months Ago

Berlin

Experience Points 17,370
Experience Level 4

2,630 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 169
Lessons
Completed
Best Reply Awards 0
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.

14 May
6 days ago

MadMaks left a reply on What's Wrong With This?

I think the where filter is wrong and also you don't need to do ->get()->first(), do instead only ->firstOrFail() for example:

$profilelist = DB::table('users')
  ->select('id','name', 'phone', 'email')
  ->where('id' , $userID)
  ->firstOrFail();

MadMaks left a reply on Keep Formatted Text In Database And Display It Correctly

Hmmm, but isn't my site now hackable, because everyone can put html and php code into it????

MadMaks left a reply on Keep Formatted Text In Database And Display It Correctly

okay, i made it work. at least the new Lines.

I replaced the request like this

'body' => nl2br(request('body')),

and then echo it with normal php in the view like this:

<?php echo "{$thread->body}";?>

that works just fine for now.

MadMaks started a new conversation Keep Formatted Text In Database And Display It Correctly

Hey, If i save my text in the database and then display it in the the browser it doesn't show me the correct formatting as it was before.

I save it like this:

$thread = Thread::create([
           'title' => request('title'),
            'body' => request('body'),

in the database.

However if I disiplay it within my views, all the new lines etc. are lost.

Thank your for your answers in advance:)

10 May
1 week ago

MadMaks left a reply on Prevent White Flash

Nope, telescope says that it needs about 500ms to load a page. Is that too long? I'm running laragon from a 3.0 usb stick. Could that be the reason?

09 May
1 week ago

MadMaks started a new conversation Prevent White Flash

As i clicked through my Homepage, I remembered, that there is some kind of a white flash before the page is fully loaded. Here on Laracasts there is absolutely nothing inbetween the pageloads... It is super smooth. How can i achieve that? With best regards.

08 May
1 week ago

MadMaks started a new conversation Cache Invoices

Hi @all, I want to cache invoices for the user, because cashier needs quiet a lot of time to create them. If i do it like this, the problem would be, that all users will have the same invoices, because there is only one key generated for all users right?

if (Cache::has('invoices')) {

                $invoices = Cache::get('invoices');

            }
            if (!Cache::has('invoices')){

                Cache::put('invoices', $user->invoices(), 60*60);
                $invoices = Cache::get('invoices');

            }

how can i fix this?

Best regards, Max

02 May
2 weeks ago

MadMaks started a new conversation Call To Undefined Relationship [videolikes] On Model [App\Videopost].

Hi, i get this error message and don't know why, maybe you could help me out. Thanks in advance.

$productionPosts = Videopost::where('category' , 'Production')
            ->with('videolikes')
            ->get();

this is my user model

public function likesVideo()
    {
        return $this->belongsToMany(Videopost::class , 'videolikes')->withTimestamps();
    }

and this is my videopost model

public function hasVideoLikes()
    {
        return $this->belongsToMany(User::class , 'videolikes')->withTimestamps();
    }
20 Apr
1 month ago

MadMaks left a reply on Select Only Specific Attributes With Eager Loading

Perfect, that is exactly what i wanted to know!!! Thank you :))

MadMaks started a new conversation Select Only Specific Attributes With Eager Loading

Hey is it possible to get specific attributes with eager loading, i want to select only one attribute from the role table for example. Thanks in advance:)

$user = User::where('id', auth()->user()->id)
            ->select('name' , 'email', 'created_at','card_last_four','card_brand' , 'trial_ends_at')
            ->with(['roles' , 'subscriptions'])
            ->first();


30 Mar
1 month ago

MadMaks left a reply on Paginate Comments

Change the array with the groupby function wasn't a good idea at all. I found a solution on this page here: https://appdividend.com/2018/06/20/create-comment-nesting-in-laravel/

thanks for your effort

28 Mar
1 month ago

MadMaks started a new conversation Paginate Comments

Hey, I can't figure out how to paginate those comments. Every help is welcome :)

 public function show($slug)
    {
        $videoPost = VideoPost::where('slug', $slug)->first();
        if($videoPost->comments()->count()>0) {
            $comments = $videoPost->comments->groupBy('parent_id');
            $comments['root'] = $comments[''];
            unset($comments['']);

Best Regards

24 Mar
1 month ago

MadMaks left a reply on Multiple Post Requests To One Page

@successdav and @diegoaurino thx for your fast repiles:) works fine:)

MadMaks started a new conversation Multiple Post Requests To One Page

Hi @all, Is there a simple way, two make two post request with the same action url? Maybe with the id or the name of the forms? I tried this but it doesn't work:(

Route::post('/Video/{slug}' , ['video-comment' , 'uses' => '[email protected]']);
    Route::post('/Video/{slug}' , ['video-like' , 'uses' => '[email protected]'] );

and my forms look like this:

<form method="POST" action="/Video/{{$videoPost->slug}}" id="video-like" name="video-like">
    {{csrf_field()}}
        <button type="submit">Like</button>
    </form>

Thanks in advance for any replies:)

22 Mar
1 month ago

MadMaks started a new conversation How Can I Refactor This Queries To Get The Number Of Specific Users

Hey, is there a better way to refactor this queries? The way i did it is working but i don't think it is very smart. Any ideas?

//counts
        $PremiumUser = User::whereHas("roles", function($q){ $q->where("name", "Premium-Subscriber"); })->count();
        $Subscriber = User::whereHas("roles", function($q){ $q->where("name", "Subscriber"); })->count();
        $NewUser = User::whereDate('created_at','>=', date('Y-m-d H:is',strtotime('-7 days')))->count();


        return view('users.index', compact('users', 'PremiumUser' , 'Subscriber' , 'NewUser'));

Thanks in advance :)