GrahamMorbyDev

GrahamMorbyDev

Full Stack PHP Developer at Freelance

Member Since 3 Years Ago

Portsmouth

Experience Points
17,070
Total
Experience

2,930 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
109
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.

Level 4
17,070 XP
Feb
13
5 days ago
Activity icon

Replied to Slug URL Vs Normal URL's

It was that easy!

Awesome thank you

Activity icon

Started a new Conversation Slug URL Vs Normal URL's

I have a blog and the client wishes for URL's to be

/{{slug}}

Of course that then causes the issue with normal URL's

/login
/register

They all cause it to say not found

Is there a way to do this, its something I've yet to come up against

Feb
05
1 week ago
Activity icon

Replied to Pass Data From Blade Form To Vue Component

Thats where I have got to , of course it grabs values on page load and not when the modal is called. So Im now trying to watch something

Activity icon

Started a new Conversation Pass Data From Blade Form To Vue Component

Hey guys

So I have a form thats built in blade and at the bottom I call a modal that contains a vue component

I want to pass the values from the form to the vue component

So my form:

<form method="post" action="{{url('/create')}}" enctype="multipart/form-data">
                            @csrf
                            <div class="row">
                                <div class="col-12">
                                    <div class="form-group mb-5">
                                        <!-- Label -->
                                        <label for="contactName">
                                            Title
                                        </label>
                                        <!-- Input -->
                                        <input type="files" class="form-control" placeholder="The title of the article"
                                            id="title" name="title" />
                                    </div>
                                </div>
                                <div class="col-12">
                                    <div class="form-group mb-5">
                                        <!-- Label -->
                                        <label for="contactName">
                                            Display article on:
                                        </label>
                                        <!-- Input -->
                                        <select name="site" id="site" class="form-control" >
                                            <option value="0">All sites</option>
                                            <option value="1">This site only</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-12">
                                    <div class="form-group mb-5">
                                        <!-- Label -->
                                        <label for="contactEmail">
                                            Featured img
                                        </label>
                                        <br>
                                        <!-- Input -->
                                        <input type="file" id="image" name="image" />
                                    </div>
                                </div>
                            </div>
                            <!-- / .row -->
                            <div class="row">
                                <div class="col-12">
                                    <div class="form-group mb-7 mb-md-9">
                                        <!-- Label -->
                                        <label for="contactMessage">
                                            Article
                                        </label>
                                        <textarea name="editor" id="editor" rows="10" cols="80">
                        This is my textarea to be replaced with CKEditor.
                    </textarea>
                    <script>
                        CKEDITOR.replace('editor', {
                           filebrowserImageUploadUrl: "{{route('ckeditor.upload', ['_token' => csrf_token() ])}}",
                           filebrowserUploadMethod: 'form'
                       });
                   </script>
                                    </div>
                                </div>
                            </div>
                            <div class="row justify-content-center">
                                <div class="col-auto">
                                    <!-- Submit -->
                                    <button type="submit" name="action" value="create" class="btn btn-primary lift">
                                        Submit
                                    </button>
                                    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
                                        Launch demo modal
                                      </button>
                                </div>
                            </div>
                            <!-- / .row -->
                        </form>

and my component loads like so

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
          <div id="app">
              <example-component></example-component>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          <button type="button" class="btn btn-primary">Save changes</button>
        </div>
      </div>
    </div>
  </div>

The component has nothing in it right now

Dec
12
2 months ago
Activity icon

Awarded Best Reply on Invalid_client - Lumen Passport

So I found that

setting the header to

content-type: application/json seemed to fix the issue

Activity icon

Replied to Invalid_client - Lumen Passport

So I found that

setting the header to

content-type: application/json seemed to fix the issue

Activity icon

Replied to Invalid_client - Lumen Passport

Ok here is an update

The data im sending is

{
    "grant_type": "password",
    "client_id": 2,
    "client_secret": "pqvuOJXddWqy7uT3jLRsYqgJfFDCabY0Cjw7rvbH",
    "password": "password",
    "username": "[email protected]"
    "scope": ""
}

The client ids are for test only, they are the Password Grant Client details and I'm getting a return error of

{
    "error": "unsupported_grant_type",
    "error_description": "The authorization grant type is not supported by the authorization server.",
    "hint": "Check that all required parameters have been provided",
    "message": "The authorization grant type is not supported by the authorization server."
}
Activity icon

Started a new Conversation Invalid_client - Lumen Passport

I have installed Lumen Passport using the method outlined in the below URL:

https://medium.com/@yomiomotoso/integrating-laravel-passport-in-your-lumen-project-with-example-1c2b8719c30

I have gone through most of the steps and they all work until I get to log in and get an OAuth/token. I'm sending the client secret and client_id generated by the passport install as well as the username and password and the return I'm getting is

{
    "error": "invalid_client",
    "error_description": "Client authentication failed",
    "message": "Client authentication failed"
}

The URL im hitting is

/v1/oauth/token

I'm guessing this is a part of passport and I'm not sure which code to share with you, so any help would be welcomed

Sep
18
5 months ago
Activity icon

Replied to __construct() Must Be Of The Type Array, String Given On Event Dispatch

How I didnt spot that is beyond me!

Thank you so much, works perfectly

Activity icon

Replied to __construct() Must Be Of The Type Array, String Given On Event Dispatch

of course

//Create Telegrams
    public function post(Request $request)
    {
        $telegram = new Telegram();

        $telegram->user_id = $request['user_id'];
        $telegram->message = $request['message'];
        $telegram->read = false;

        $telegram->save();

        $user = $request['user_id'];
        $message = $request['message'];
        event(new Telegram($user, $message));
    
        //Return Response 
        return response()->json([
            'message' => 'Created Telegram',
        ], 201);
    }
Sep
17
5 months ago
Activity icon

Started a new Conversation __construct() Must Be Of The Type Array, String Given On Event Dispatch

Im sending in some $request params

user_id = 1
message = message

I then send out a event from a controller like so:

$user = $request['user_id'];
$message = $request['message'];
event(new Telegram($user, $message));

and then the event construct looks like so:

class Telegram implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $user;
    public $message;

    public function __construct($user, $message) 
    {
        $this->user = $user;
        $this->message = $message;
        
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new Channel('telegram');
    }
}

And im getting the error

Symfony\Component\Debug\Exception\FatalThrowableError: Argument 1 passed to Illuminate\Database\Eloquent\Model::__construct() must be of the type array, string given,
Sep
10
5 months ago
Activity icon

Started a new Conversation Broadcasting Error | Socket:null

Im trying to get Pusher working and all my events get sent with the follow

[2019-09-10 16:07:13] local.INFO: Broadcasting [App\Events\NewTradeMessage] on channels [New_Trade] with payload:
{
    "socket": null
} 

Im logging all events in an attempt to debug but pusher is connected to the channel etc

any ideas?

Sep
09
5 months ago
Activity icon

Started a new Conversation Echo + Redis

Hey Guys I'm building a one-page app, My environment is Laravel backend API with Vue as the client all in a single project, Im trying to build a chat channel using Redis, Echo and Socket IO

Currently hitting a snag and have nothing firing through echo

So my event -

class MessageSent implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $user;
    public $message;
    public $username;

    public function __construct($user, $message, $username) 
    {
        $this->user = $user;
        $this->message = $message;
        $this->username = $username;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new Channel('chat');
    }
}

My controller for the chat

public function post(Request $request) {
    //Set Message Model
    $message =  new Message();

    //Get Request params
    $message->user_id = $request['user_id'];
    $message->message = $request['message'];
    $message->username = $request['username'];
    $message->trade_id = $request['trade_id'];

    //Save to DB
    $message->save();

    
    $user = $request['user_id'];
    $message = $request['message'];
    $username = $request['username'];

    MessageSent::dispatch($user, $message, $username);

    //Return Response 
    return response()->json([
      'message' => 'Message created'
    ], 201);
  }

and my echo pick up

 window.Echo.channel("chat").listen("MessageSent", e => {
      this.messages.push(e);
    });

Also my .env is set up for redis

CACHE_DRIVER=file
QUEUE_CONNECTION=redis
QUEUE_DRIVER=redis
BROADCAST_DRIVER=redis

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

OK so the response from the server is a 201 when its created but I'm getting nothing via echo, hope that makes sense

Aug
28
5 months ago
Activity icon

Replied to {message: "The POST Method Is Not Supported For This Route. Supported Methods: GET, HEAD.",…}

The Auth middelware wouldnt stop the request going through but would throw an error when no Token is given

Aug
27
5 months ago
Activity icon

Replied to {message: "The POST Method Is Not Supported For This Route. Supported Methods: GET, HEAD.",…}

I have cleared the cache and run a list again and getting the same issue

+--------+---------------+-----------------------------------------+-----------------------------------+---------------------------------------------------------------------------+--------------+
| Domain | Method        | URI                                     | Name                              | Action                                                                    | Middleware   |
+--------+---------------+-----------------------------------------+-----------------------------------+---------------------------------------------------------------------------+--------------+
|        | POST          | api/auth/login                          |                                   | App\Http\Controllers\[email protected]                                 | api          |
|        | GET|HEAD      | api/auth/logout                         |                                   | App\Http\Controllers\[email protected]                                | api,auth:api |
|        | POST          | api/auth/signup                         |                                   | App\Http\Controllers\[email protected]                                | api          |
|        | GET|HEAD      | api/auth/user                           |                                   | App\Http\Controllers\[email protected]                                  | api,auth:api |
|        | POST          | api/block/delete                        |                                   | App\Http\Controllers\[email protected]                               | api,auth:api |
|        | GET|HEAD      | api/block/get                           |                                   | App\Http\Controllers\[email protected]                                  | api          |
|        | POST          | api/block/post                          |                                   | App\Http\Controllers\[email protected]                                 | api,auth:api |
|        | POST          | api/block/put                           |                                   | App\Http\Controllers\[email protected]                                  | api,auth:api |
|        | POST          | api/feedback/delete                     |                                   | App\Http\Controllers\[email protected]                            | api,auth:api |
|        | GET|HEAD      | api/feedback/get                        |                                   | App\Http\Controllers\[email protected]                               | api          |
|        | POST          | api/feedback/post                       |                                   | App\Http\Controllers\[email protected]                              | api,auth:api |
|        | POST          | api/feedback/put                        |                                   | App\Http\Controllers\[email protected]                               | api,auth:api |
|        | POST          | api/message/post                        |                                   | App\Http\Controllers\[email protected]                                 | api          |
|        | GET|HEAD      | api/pricing/get                         |                                   | App\Http\Controllers\[email protected]                                | api          |
|        | GET|HEAD      | api/pricing/post                        |                                   | App\Http\Controllers\[email protected]                               | api          |
|        | POST          | api/trade/delete                        |                                   | App\Http\Controllers\[email protected]                               | api,auth:api |
|        | GET|HEAD      | api/trade/get                           |                                   | App\Http\Controllers\[email protected]                                  | api          |
|        | POST          | api/trade/post                          |                                   | App\Http\Controllers\[email protected]                                 | api,auth:api |
|        | POST          | api/trade/put                           |                                   | App\Http\Controllers\[email protected]                                  | api,auth:api |
|        | POST          | api/trust/delete                        |                                   | App\Http\Controllers\[email protected]                               | api,auth:api |
|        | GET|HEAD      | api/trust/get                           |                                   | App\Http\Controllers\[email protected]                                  | api          |
|        | POST          | api/trust/post                          |                                   | App\Http\Controllers\[email protected]                                 | api,auth:api |
|        | POST          | api/trust/put                           |                                   | App\Http\Controllers\[email protected]                                  | api,auth:api |
|        | GET|HEAD      | api/users/get                           |                                   | App\Http\Controllers\[email protected]                                   | api          |
|        | GET|POST|HEAD | broadcasting/auth                       |                                   | Illuminate\Broadcasting\[email protected]                  | web          |
|        | GET|HEAD      | oauth/authorize                         | passport.authorizations.authorize | Laravel\Passport\Http\Controllers\[email protected]       | web,auth     |
|        | POST          | oauth/authorize                         | passport.authorizations.approve   | Laravel\Passport\Http\Controllers\[email protected]  | web,auth     |
|        | DELETE        | oauth/authorize                         | passport.authorizations.deny      | Laravel\Passport\Http\Controllers\[email protected]        | web,auth     |
|        | POST          | oauth/clients                           | passport.clients.store            | Laravel\Passport\Http\Controllers\[email protected]                  | web,auth     |
|        | GET|HEAD      | oauth/clients                           | passport.clients.index            | Laravel\Passport\Http\Controllers\[email protected]                | web,auth     |
|        | DELETE        | oauth/clients/{client_id}               | passport.clients.destroy          | Laravel\Passport\Http\Controllers\[email protected]                | web,auth     |
|        | PUT           | oauth/clients/{client_id}               | passport.clients.update           | Laravel\Passport\Http\Controllers\[email protected]                 | web,auth     |
|        | POST          | oauth/personal-access-tokens            | passport.personal.tokens.store    | Laravel\Passport\Http\Controllers\[email protected]     | web,auth     |
|        | GET|HEAD      | oauth/personal-access-tokens            | passport.personal.tokens.index    | Laravel\Passport\Http\Controllers\[email protected]   | web,auth     |
|        | DELETE        | oauth/personal-access-tokens/{token_id} | passport.personal.tokens.destroy  | Laravel\Passport\Http\Controllers\[email protected]   | web,auth     |
|        | GET|HEAD      | oauth/scopes                            | passport.scopes.index             | Laravel\Passport\Http\Controllers\[email protected]                     | web,auth     |
|        | POST          | oauth/token                             | passport.token                    | Laravel\Passport\Http\Controllers\[email protected]        | throttle     |
|        | POST          | oauth/token/refresh                     | passport.token.refresh            | Laravel\Passport\Http\Controllers\TransientTokenContro[email protected]        | web,auth     |
|        | GET|HEAD      | oauth/tokens                            | passport.tokens.index             | Laravel\Passport\Http\Controllers\[email protected] | web,auth     |
|        | DELETE        | oauth/tokens/{token_id}                 | passport.tokens.destroy           | Laravel\Passport\Http\Controllers\[email protected] | web,auth     |
|        | GET|HEAD      | {any}                                   |                                   | App\Http\Controllers\[email protected]                           | web  
Activity icon

Replied to {message: "The POST Method Is Not Supported For This Route. Supported Methods: GET, HEAD.",…}

Hey Guys

Thanks

I checked teh route list and mine is the only one there

also to test I changed the URL route to 'api/message/post'

And still the same error, its very strange

Activity icon

Started a new Conversation {message: "The POST Method Is Not Supported For This Route. Supported Methods: GET, HEAD.",…}

Hey Guys

So I have an API route

Route::post('chat/post', '[email protected]');

And a controller

public function post(Request $request) {
    //Set Message Model
    $messages =  new Message();

    //Get Request params
    $message->user_id = $request['user_id'];
    $message->message = $request['message'];

    //Save to DB
    $message->save();

    //Return Response 
    return response()->json([
      'message' => 'Message created'
    ], 201, $headers);

  }

And im using that from

post_chat() {
      const postdata = {
        user_id: this.trade_data.user_id,
        message: this.message      };
      axios.post("api/chat/post", postdata, {
          headers: {
            Authorization: "Bearer " + this.api_token
          }
        }).then(response => {
          console.log(response);
      })
    }

And I have now been staring at the error for over two hours and can't see why I'm getting the error

Its either going to be a typo or something completely different but any help would be wonderful