GrahamMorbyDev

GrahamMorbyDev

Full Stack PHP Developer at Freelance

Member Since 3 Years Ago

Portsmouth

Experience Points
16,830
Total
Experience

3,170 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
16,830 XP
Sep
18
1 month 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
1 month 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
1 month 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
1 month 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
1 month 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
1 month 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\[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

Aug
12
2 months ago
Activity icon

Replied to Laravel Scheduling Not Firing Command

Added a new cron and changed and it worked fine

First I tested if cron was running

> sudo service cron status

then enabled laravel's scheduler:

> crontab -e

and then added

* * * * * php /var/www/api/artisan schedule:run 1>> /dev/null 2>&1

and all works great now

Activity icon

Replied to Laravel Scheduling Not Firing Command

Bump - Still, the artisan command works but no auto running

Aug
09
2 months ago
Activity icon

Replied to Laravel Scheduling Not Firing Command

Trying now, it would seem that hasn't worked either

Activity icon

Replied to Laravel Scheduling Not Firing Command

Yeah nothing is showing on the syslog and no errors anywhere

Activity icon

Started a new conversation Laravel Scheduling Not Firing Command

Hi Guys

I have a simple set up a command for Scheduling that is firing on a cron call

The artisan command works fine yet nothing happens when Scheduling

The Schedule

protected function schedule(Schedule $schedule)
    {
        $schedule->command('prices:pricing')
            ->everyMinute();
    }

The task

protected $signature = 'prices:pricing';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Gets Pricing data and stores in DB';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
     Log::debug('An informational message.');
     }
}

then my cron job is

* * * * *  www-data  cd /var/www/api  &&  php artisan schedule:run  >> /dev/null 2>&1
Aug
03
2 months ago
Activity icon

Replied to Password Confirmation Error When Using Vue With Laravel Auth

I have wasnt sending the

Password_confirmation field and it's now all good

Aug
01
2 months ago
Activity icon

Started a new conversation Password Confirmation Error When Using Vue With Laravel Auth

Im trying to use laravel auth with a vue client

Im creating an account and im getting the error on submit

{"message":"The given data was invalid.","errors":{"password":["The password confirmation does not match."]}}

My post is as follows

sign_up() {
      const postdata = {
        email: this.email,
        name: this.username,
        password: this.password,
        };
      this.$validator.validateAll().then(result => {
        if (result) {
          axios
            .post("/register", postdata)
            .then(response => console.log("blah"));
        }
        if (!result) {
          console.log("errors");
        }
      });
    }

Im validating password on the front end with vee-validate

 <div class="form-group">
          <label for="password">Password</label>
          <input
            v-model="password"
            v-validate="'required|min:8|max:16'"
            name="password"
            :error-message="errors.collect('password')"
            type="password"
            class="form-control"
            id="password"
            aria-describedby="Password"
            ref="password"
          />
          <small class="text-danger">{{errors.first('password')}}</small>
        </div>
        <div class="form-group">
          <label for="confirm">Confirm Password</label>
          <input
            v-model="confirm"
            v-validate="'required|min:8|max:16|confirmed:password'"
            name="confirm"
            :error-message="errors.collect('confirm')"
            type="password"
            class="form-control"
            id="confir."
            aria-describedby="Confirm Password"
          />
          <small class="text-danger">{{errors.first('confirm')}}</small>
        </div>
Jul
24
2 months ago
Activity icon

Started a new conversation 500 Server Error With Guzzle On Lumen

Hey Folks

I have been looking at this for some time

Route

$router->get('/v2/stellar/get', '[email protected]'); 

Controller

 public function get()
    {
        try {

            $client = new \GuzzleHttp\Client(); //GuzzleHttp\Client
            $result = $client->request('GET', 'URL;
            var_dump('<pre>' . $result . '</pre>');
        } catch (\GuzzleHttp\Exception $e) {
            var_dump('<pre>' . $e . '</pre>');
        }
        //Return $result;
    }

Just getting a 500 error, I have checked logs and everything, any ideas

Jan
04
9 months ago
Activity icon

Replied to Filter Multiple Columns Vue

@HFALUCAS - works perfectly thank you

Activity icon

Replied to Filter Multiple Columns Vue

@HFALUCAS - I get

Uncaught TypeError: Cannot read property 'toLowerCase' of undefined

Jan
03
9 months ago
Activity icon

Started a new conversation Filter Multiple Columns Vue

Hey Guys

I have a search that works right now and wanted to search multiple keys in an array.

I have a standard form that takes a keyword

its then hits this function:

searchResults() {
      const search = this.bets.filter(bet => {
        return bet.username.toLowerCase() === this.searchTable;
      });
      this.bets = search;
    }

So in this case im searching username, but id like to add more columns

I have tried

searchResults() {
      const search = this.bets.filter(bet => {
        return bet.username.toLowerCase() || bet.bet_id.toLowerCase === this.searchTable;
      });
      this.bets = search;
    }

Any help would be welcomed

Dec
03
10 months ago
Activity icon

Started a new conversation 'vue-cli-service' Is Not Recognized As An Internal Or External Command, Operable Program Or Batch File.

Im trying to set up a windows environment with the cli but when I hit

npm run serve

I get the following error

'vue-cli-service' is not recognized as an internal or external command, operable program or batch file.

node and npm are both upto date

Nov
08
11 months ago
Activity icon

Replied to Adding A / To A Concat String

Awesome ill give it a go

Activity icon

Replied to Adding A / To A Concat String

Im trying to build a quick fix search box for someone

 foreach ($dmcas as $key => $dmca) {

                    $output .= '<tr>' .
                        
                        '<td>' . $dmca->id . '</td>' .

                        '<td>' . $dmca->company . '</td>' .

                        '<td>' . $dmca->client . '</td>' .

                        '<td>' . $dmca->created_at . '</td>' .
                        '<td>'.  
                            '<form action="{{url("/view/dmca")}}" method="post">' .
                                '<input type="hidden" name="_token" id="csrf-token" value="{{ Session::token() }}" />'.
                                '<input type="hidden" name="id" id="id" value="' . $dmca->id .'">'.
                                '<button type="submit" class="btn btn-sm btn-success">View</button>'.
                            '</form>'.
                        '</td>'.
                        '</tr>';

                }

Its horrible but its a proof of concept

Activity icon

Replied to Adding A / To A Concat String

@CRONIX - this string

'<form action="{{url("/view/dmca")}}" method="post">' .

outputs to

<form action="{{url("  view dmca")}}"="" method="post">

No / in the output so I need to get the / in the output

Activity icon

Replied to Adding A / To A Concat String

Its for a live search, i need it to output that when the search happens but the / is outputting

Activity icon

Started a new conversation Adding A / To A Concat String

Hey guys

I'm trying to output a string like so

'<form action="{{URL::asset("' . "/" . 'view' . "/" .'dmca' . '")}}" method="post">' .

but the / are not coming out any ideas??

Oct
29
11 months ago
Activity icon

Started a new conversation "TypeError: Cannot Read Property 'bets' Of Undefined"

A Question, I have a prop which contains an object that is outputting to the view fine but have a console error which reads

vue.runtime.esm.js?2b0e:587 [Vue warn]: Error in render: "TypeError: Cannot read property 'bets' of undefined"```

and 

Cannot read property 'bets' of undefined


My question is why do I have this error yet the data is outputting?

My Component looks like 

<div class="row">
        <div class="col-md-3">
            <ul class="list-group mbs">
                <li class="list-group-item stats-box"><b>Bets:</b> <span class="pull-right text-success"><b>{{stats.bets}}</b></span></li>
            </ul>
        </div>
        <div class="col-md-3">
            <ul class="list-group mbs">
                <li class="list-group-item stats-box"><b>Won/Lost:</b> <span class="pull-right"><b class="text-success">{{stats.wins}}</b><b> / </b><b class="text-danger">{{stats.lost}}</b></span></li>
            </ul>
        </div>
        <div class="col-md-3">
            <ul class="list-group mbs">
                <li class="list-group-item stats-box"><b>Wagered:</b> <span class="pull-right text-success"><b>{{stats.wagered}}</b></span></li>
            </ul>
        </div>
        <div class="col-md-3">
            <ul class="list-group mbs">
                <li class="list-group-item stats-box"><b>Profit:</b>
                    <span class="pull-right text-danger"><b>{{stats.profit}}</b></span>
                </li>
            </ul>
        </div>
    </div>
</template>
<script>

export default {
    props: {
        stats: Object
    },
   data() {
        return{
           
        }
    },
    methods: {}
}
</script>

Oct
11
1 year ago
Activity icon

Replied to "message": "SQLSTATE[23000]: Integrity Constraint Violation: 1062 Duplicate Entry '' For Key 'users_email_unique'

I don't get why it's trying to update the email?? I'm simply asking it to log in and create a token?? Or did I do something wrong

Activity icon

Started a new conversation "message": "SQLSTATE[23000]: Integrity Constraint Violation: 1062 Duplicate Entry '' For Key 'users_email_unique'

Hey so I have a login module that is suddenly giving me an error

"message": "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'users_email_unique' (SQL: insert into `users` (`updated_at`, `created_at`) values (2018-10-11 13:17:54, 2018-10-11 13:17:54))",

the login code looks like

 //The createToken method is one of the methods Laravel Passport adds to the user model.
    public function login(Request $request) {

        if(Auth::attempt(['email' => $request->get('email'), 'password' => $request->get('password')])) {
            $status = 200;
            $response = [
                'user' => Auth::user(),
                'token' => Auth::user()->create(['bigStore'])->accessToken,
            ];
        return response()->json($response, $status);
        }else {
            $status = 401;
            $response = ['error' => 'Unauthorised'];
            return response()->json($response, $status);
        }

    }

and the front end is

handleSubmit(e) {
                e.preventDefault();
                if (this.password.length > 0) {
                    let email = this.email;
                    let password = this.password;

                    axios.post('api/login', {email, password}).then(response => {
                        let user = response.data.user;
                        let is_admin = user.is_admin;

                        localStorage.setItem('bigStore.user', JSON.stringify(user));
                        localStorage.setItem('bigStore.jwt', response.data.token);

                        if (localStorage.getItem('bigStore.jwt') != null) {
                            this.$emit('loggedIn');
                            if (this.$route.params.nextUrl != null) {
                                this.$router.push(this.$route.params.nextUrl)
                            } else {
                                this.$router.push((is_admin === 1 ? 'admin' : 'dashboard'))
                            }
                        }
                    });
                }
            }
Sep
17
1 year ago
Activity icon

Replied to The File "/home/forge/default/public/storage/app/videos/testingvideo12.mp4" Does Not Exist

of course, The videos are storing as

 //Validate the Video
        $this->validateVideo($request);

        //Image
        $imagepath = $request->file('featuredimage')->store('videoimages');

        $title = $request->get('title') . ".mp4";

        //Video
        $videopath = $request->file('filename')->storeAs('videos', $title);

        //Open Video Model
        $video = new Video();

        //Video Params
        $video->title = $request->get('title');
        $video->description = $request->get('description');
        $video->featuredimage = $imagepath;
        $video->filename = $videopath;
        $video->storeId = $request->get('storeId');
        $video->filesize = $request->get('filesize');

        //Save Video
        $video->save();

        //Return Statement
        return 200;

Activity icon

Started a new conversation The File "/home/forge/default/public/storage/app/videos/testingvideo12.mp4" Does Not Exist

I have an API that's uploading and downloading videos and I have the issue in the title.

The file exists and as I uploaded it yet it's saying its not there

Code is :

$get = new Transaction();
        $get = $get->where('salesId', $request->get('salesId'))->firstOrFail();

        if($get->downloadAttempts <= 3) {
            $filename = $request->get('filename');
            $filePath = public_path('storage/app/videos/' . $filename);
            return response()->download($filePath, $request->get('filename'));
        }else {
            return 403;
        }

The filename matches the stored one in the post to get the file

Thanks in advance

Activity icon

Started a new conversation Issue With File Download For An API

Hey folks,

First time I have tried this so working through the issues. So I have a get request that has params being sent.

Download Controller

//Download Video
    public function Download(Request $request) {
        $download = new Transaction();
        $download = $download->where('salesId', $request->get('salesId'))->increment('downloadAttempts');


        $get = new Transaction();
        $get = $get->where('salesId', $request->get('salesId'))->get();

        if($get->downloadAttempts <= 3) {
            $filename = $request->get('filename');
            $filePath = public_path('storage/' . $filename);
            return response()->download($filePath, $request->get('filename'));
        }else {
            return 403;
        }
    }

So it gets the sales ID and updates the download attempts by 1 and then checks if the attempts are less than 3 and allow the download.

and I'm getting an error of

Property [downloadAttempts] does not exist on this collection instance.

Sep
06
1 year ago
Activity icon

Started a new conversation Laravel Cashier - No Such Token

Hey I'm trying to set up laravel cashier and getting an error of

No such token:

My Form looks like

<div class="col-md-12">
            <form action="/subscribe_process" method="POST">
                <script
                        src="https://checkout.stripe.com/checkout.js" class="stripe-button"
                        data-key="{{ env('STRIPE_PUBLISHABLE_SECRET') }}"
                        data-amount="1999"
                        data-name="Retro Gamer Crate"
                        data-description="Online course about integrating Stripe"
                        data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
                        data-locale="auto"
                        data-currency="usd">
                </script>
            </form>
        </div>

and my controller like so

public function subscribe_process(Request $request)
    {

        try {
            Stripe::setApiKey(env('STRIPE_SECRET'));

            $user = User::find(3);

            $customer = Customer::create(array(
                'email' => $request->stripeEmail,
                'source' => $request->stripeToken
            ));

            $user->newSubscription('retrogamercrate', 'prod_DYZ07fQJTO3F4J')->create($request->stripeToken);

            return 'Subscription successful, you get the course!';
        }
        catch (\Exception $ex) {
            return $ex->getMessage();
        }

    }

I have set the plan up in stripe on test data

Aug
28
1 year ago
Activity icon

Replied to Undefined Property: StdClass::$cover

my Controller looks like

 //Coming Soon
    public function comingsoon() {
        $game = IGDB::searchGames('fallout');
        $game  = json_decode($game, true);
        //dd($game);
        return view('comingsoon', compact('game'));
    }
Activity icon

Replied to Undefined Property: StdClass::$cover

So I did as suggested and get

json_decode() expects parameter 1 to be string, array given

Activity icon

Started a new conversation Undefined Property: StdClass::$cover

I have a json object that contains 10 results and I want to loop through and display the data to the user

a example looks like this:

9 => {#670 ▼
    +"id": 10300
    +"name": "Fallout 3: Mothership Zeta"
    +"slug": "fallout-3-mothership-zeta"
    +"url": "https://www.igdb.com/games/fallout-3-mothership-zeta"
    +"created_at": 1431649834920
    +"updated_at": 1532126985619
    +"summary": "Defy hostile alien abductors and fight your way off of the massive Mothership Zeta, orbiting Earth miles above the Capital Wasteland. Mothership Zeta takes Fall ▶"
    +"collection": 3
    +"rating": 77.763623864376
    +"popularity": 1.3333333333333
    +"total_rating": 77.763623864376
    +"total_rating_count": 29
    +"rating_count": 29
    +"game": 15
    +"games": array:10 [▶]
    +"tags": array:4 [▶]
    +"developers": array:1 [▶]
    +"publishers": array:1 [▶]
    +"category": 1
    +"player_perspectives": array:1 [▶]
    +"game_modes": array:1 [▶]
    +"themes": array:1 [▶]
    +"genres": array:2 [▶]
    +"first_release_date": 1249257600000
    +"platforms": array:3 [▶]
    +"release_dates": array:3 [▶]
    +"screenshots": array:7 [▶]
    +"cover": {#681 ▼
      +"url": "//images.igdb.com/igdb/image/upload/t_thumb/btawsi7cbgcmqlw67tpn.jpg"
      +"cloudinary_id": "btawsi7cbgcmqlw67tpn"
      +"width": 1061
      +"height": 1158
    }
  }

So I do a foreach loop and put

  @foreach($game as $games)
            <div class="col-md-2">
                <img src="" alt="">
                <p>{{$games->name}}</p>
                <p>{{$games->cover->url}}</p>
            </div>
        @endforeach         

And get the error

Undefined property: stdClass::$cover

I am trying to loop through 10 objects the one above is just an example of one of those objects

Aug
23
1 year ago
Activity icon

Started a new conversation Custom Login Route Error With Passport And Vue.Js

So I have a front end Vue connecting to a Laravel backend with Passport

I have a custom Login Controller which looks like so

//Authenticates a user and generates an access token for that user.
    //The createToken method is one of the methods Laravel Passport adds to the user model.
    public function login(Request $request) {
        $status = 401;
        $response = ['error' => 'Unauthorised'];

        if(Auth::attempt($request->only('email', 'password'))) {
            $status = 200;
            $response = [
                'user' => Auth::user(),
                'token' => Auth::user()->create('bigstore')->accessToken,
            ];
        }

        return response()->json($response, $status);
    }

then on the login it looks like

methods: {
            handleSubmit(e) {
                e.preventDefault()
                if (this.password.length > 0) {
                    let email = this.email
                    let password = this.password

                    axios.post('api/login', {email, password}).then(response => {
                        let user = response.data.user
                        let is_admin = user.is_admin

                        localStorage.setItem('bigStore.user', JSON.stringify(user))
                        localStorage.setItem('bigStore.jwt', response.data.token)

                        if (localStorage.getItem('bigStore.jwt') != null) {
                            this.$emit('loggedIn')
                            if (this.$route.params.nextUrl != null) {
                                this.$router.push(this.$route.params.nextUrl)
                            } else {
                                this.$router.push((is_admin == 1 ? 'admin' : 'dashboard'))
                            }
                        }
                    });
                }
            }
        }

and I get this error

"message": "Argument 1 passed to Illuminate\Database\Eloquent\Builder::create() must be of the type array, string given, called in /Users/grahammorby-raybould/sites/peach/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php on line 1570",
Aug
12
1 year ago
Activity icon

Started a new conversation Bootstrap Vue Models

Hey Folks

Here is a question: I have started to build a Vue Js store, Using Laravel on the back end. I have installed Bootstrap Vue to use its models and loaded it into the page but it's showing up behind everything. The only way I know its there is by doing Inspect Element and hunting for it. Any help would be wonderful, or a different way of doing it? Open to all as I'm learning this stuff:

<template>
    <div>
    <div>
        <b-modal ref="myModalRef" hide-footer title="Using Component Methods">
            Hello From Modal!
        </b-modal>
    </div>
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="col-md-4">
                    <h3>Welcome To Our Store</h3>
                </div>
                <div class="col-md-4"></div>
                <div class="col-md-4">
                    <a href="#" class="btn btn-sm btn-success pull-right">View Cart</a>
                </div>
            </div>
        </div>
        <div class="row justify-content-center">
            <div class="col-md-12">
                <div v-for="infos in info">
                    <div class="col-md-4">
                        <div class="product-item">
                            <div class="pi-img-wrapper">
                                <img src="http://keenthemes.com/assets/bootsnipp/k1.jpg" class="img-responsive"
                                     alt="Berry Lace Dress">
                                <div>
                                    <a href="#" class="btn">Zoom</a>
                                    <a @click="showModal()" class="btn">View</a>
                                </div>
                            </div>
                            <h3><a href="#">{{infos.title}}</a></h3>
                            <div class="pi-price">${{infos.price}}</div>
                            <a href="javascript:" class="btn add2cart">Add to cart</a>
                            <div class="sticker sticker-new"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
</template>

<script>

    import BootstrapVue from 'bootstrap-vue'
    import bModal from 'bootstrap-vue/es/components/modal/modal'
    Vue.use(BootstrapVue);

    export default {
        components: {
            bModal,
        },
        data() {
            return {
                info: [],
                modalShow: false
            }
        },
        mounted() {
            console.log('Component mounted.');
            axios.get('/store/get/products')
                .then(response => (this.info = response.data)).catch(error => console.log(error))
        },
        methods: {
            showModal () {
                this.$refs.myModalRef.show();
                console.log('here');
            },
            hideModal () {
                this.$refs.myModalRef.hide()
            }},
    }
</script>

Thanks Again

Jul
07
1 year ago
Activity icon

Started a new conversation Vue Parallax Ontop Of Parallax

So here is a question and I'm not really sure how to do it.

I have a parallax image background and I want to load ahead tag on top to have both move away at different speeds.

So the image will be the background and the text the foreground but both have parallax

<parallax :parallax="true" :direction="up" :containerClass="mainHead" :speedFactor="1">
        <img src="img/header.jpg" alt="Welcome to butterfly software developments" height="600px"/>
        <h1>Lipsum Text</h1>
    </parallax>

That's my code

and the package I'm using is

https://github.com/apertureless/vue-parallax

Thanks

Jul
02
1 year ago
Activity icon

Replied to Error On Templating

Perfect, the one thing I never tried!

Activity icon

Started a new conversation Error On Templating

So I have a strange one that has never happened before

I have a template file that looks like:

<template>

        <parallax><img src="img/header.jpg" alt="Welcome to butterfly software developments"/></parallax>

</template>
<script>
    import Parallax from 'vue-parallaxy'
    export default {
        components: {
            Parallax
        }
    }
</script>

Now if I place any more HTML or code under the tags and within the tags I get the following error

ERROR in ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-3e2113e2","hasScoped":false,"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./resources/assets/js/views/Hello.vue
(Emitted value instead of an instance of Error) 
  Error compiling template:
  
      <parallax>
          <img src="img/header.jpg" alt="Welcome to butterfly software developments">
      </parallax>
  dfgdfgsdf
  
  - text "dfgdfgsdf" outside root element will be ignored.

 @ ./resources/assets/js/views/Hello.vue 6:23-261
 @ ./resources/assets/js/app.js
 @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

Any help woiuld be great

Jun
19
1 year ago
Activity icon

Replied to Server IP Address Could Not Be Found.

one of the domains was actually already live I just moved server, its strange

Activity icon

Replied to Server IP Address Could Not Be Found.

I did indeed

both have A records

Activity icon

Started a new conversation Server IP Address Could Not Be Found.

So I have an issue im not really sure what to do with

I have set up new apps on each of my servers using the domain name, deleted the default app. Set up domains in digital ocean to push to the correct droplets and set up my nameservers on my domains.

But getting the error server IP address could not be found.

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/watermelon.solutions/before/*;

server {
    listen 80;
    listen [::]:80;
    server_name watermelon.solutions;
    root /home/forge/watermelon.solutions/public;

    # FORGE SSL (DO NOT REMOVE!)
    # ssl_certificate;
    # ssl_certificate_key;

    ssl_protocols TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
    ssl_prefer_server_ciphers on;
    ssl_dhparam /etc/nginx/dhparams.pem;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/watermelon.solutions/server/*;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/watermelon.solutions-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/watermelon.solutions/after/*;

and name servers are normal

ns1.digitalocean.com etc ete

May
25
1 year ago
Activity icon

Replied to Getting Data Range

man I couldnt see it! Thanks

Activity icon

Replied to Getting Data Range

sorry yeah

$today = Carbon::now(); $lastWeek = Carbon::now()->subDays(7);

Activity icon

Started a new conversation Getting Data Range

So I'm trying to get data within a 7-day date range

The data exists but I have no returning results

    $sageWorkers = DB::table('workers')
                         ->leftJoin('assign_worker_contracts', 'workers.id', '=', 'assign_worker_contracts.worker_id')
                         ->where('assign_worker_contracts.created_at', '=>' , $lastWeek)->where('assign_worker_contracts.created_at', '<=', $today)
                         ->get();

I'm sure I'm missing something easy but I have been staring at it for some time now