mvpop

mvpop

Member Since 10 Months Ago

Experience Points 3,720
Experience Level 1

1,280 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 35
Lessons
Completed
Best Reply Awards 0
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.

22 Apr
2 months ago

mvpop left a reply on Keyboard Shortcuts For Laravel App

@DIEGOAURINO - Thanks for your response.

Yes that definitely helps because I was thinking to add vue in my app already and this is yet another reason to do so.

mvpop started a new conversation Keyboard Shortcuts For Laravel App

So I want to have keyboard shortcuts within my laravel app so the users can operate the entire app without having to use their mouse.

I have found few options that would do that job but dunno which one to choose or if there's already a package for laravel to do just that.

The problem is that I have so many solutions for my problem that I don't know which one to use.

Any advices ?

19 Feb
4 months ago

mvpop left a reply on Edit() And Destroy() Functions Not Working On Shared Hosting

On my machine "user_id" is an integer as expected but in production "user_id" returns a string... any thoughts why is this happening to me ? Or should I just cast data types "just in case" ?

mvpop left a reply on Edit() And Destroy() Functions Not Working On Shared Hosting

it is working if I specify the expected data types...

 if( (int)auth()->user()->id !== (int) $post->user_id) {
                   return redirect('/articles')->with('error', 'Unauthorized Page');
            }

mvpop left a reply on Edit() And Destroy() Functions Not Working On Shared Hosting

@BOBBYBOUWMANN - Yes and that's also how it's working on localhost... hence the confusion...

mvpop left a reply on Edit() And Destroy() Functions Not Working On Shared Hosting

@ARTHVRIAN - They are both "1" (both users and posts)

mvpop left a reply on Edit() And Destroy() Functions Not Working On Shared Hosting

@ARTHVRIAN - The only difference I can spot between localhost and shared hosting in the database is the cardinality... localhost is having "1" and on the server is "2".

mvpop left a reply on Edit() And Destroy() Functions Not Working On Shared Hosting

@ARTHVRIAN - Yes it looks like that was the problem. But then why it worked on my localhost ?

mvpop left a reply on Edit() And Destroy() Functions Not Working On Shared Hosting

@ARTHVRIAN - yeah, it's dumping the expected (correct) data.

mvpop left a reply on Edit() And Destroy() Functions Not Working On Shared Hosting

@ARTHVRIAN - I've tried the second version and is returning "Unauthorised" every time even tho it should be authorised. So perhaps not getting the user id's as it should...

mvpop left a reply on Edit() And Destroy() Functions Not Working On Shared Hosting

Ok so I just removed this code from my destroy() function and now it's working.

if (auth()->user()->id !== $post->user_id) {
    return redirect('/articles')->with('error', 'Unauthorized Page');
}

I still can't understand the following:

1 - on localhost it's working just fine with this if statement inside. 2 - why is not working, the code, at least syntax wise I can't spot any errors.

mvpop left a reply on Edit() And Destroy() Functions Not Working On Shared Hosting

@SKYCODER - I have spoken with them already. They said they aren't blocking anything on their side and I can check and uncheck PHP extension in my cPanel.

mvpop left a reply on Edit() And Destroy() Functions Not Working On Shared Hosting

@BOBBYBOUWMANN - Thanks for your reply. Yes that's the line that is blocking everything but for some reason works on my localhost. And then as you said no error message displayd.

I create a fresh new user and same thing happens. At first I tought was because I imported that SQL database and the user. But I have created a new user. (once you are logged in with the test user you have access to /register so you can create a new user).

I really think this should be some sort of server configuration error since on my localhost is working... I haven't found anything similar on stackoverflow or googleing.

mvpop started a new conversation Edit() And Destroy() Functions Not Working On Shared Hosting

Hello folks,

My problem is as follows:

I have redesigning my personal website so now it's laravel based. On my machine it's all fine but once deployed to a shared hosting, on the blog ("/articles") I can only add new posts. I can't edit or delete existing posts.

This are my edit and destroy functions in PostsController.php

public function edit($id)
        {
            $post = Post::find($id);
        
            if(auth()->user()->id !== $post->user_id) {
                return redirect('/articles')->with('error', 'Unauthorized Page');
            }
            
            return view('articles.edit')->with('post', $post);
        }
public function destroy($id)
            {
                $post = Post::find($id);
                
                if(auth()->user()->id !== $post->user_id) {
                    return redirect('/articles')->with('error', 'Unauthorized Page');
                }
                
                if($post->featured_image != 'noimage.png') {
                    // Delete Image
                    Storage::delete('public/featured_images/'.$post->featured_image);
                }
                
                $post->delete();
                return redirect('/articles')->with('success', 'Article Removed');
            }
        }

Hopefully it's just something related to the server and not an error in my code since it's working just fine on localhost.

If you want to have a play here are the credentials to my website:

http://mvpop.co.uk/login email: [email protected] pass: 123456abc

Thanks in advance.