Crazylife

Member Since 3 Years Ago

Experience Points
11,740
Total
Experience

3,260 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
4
Lessons
Completed
Best Reply Awards
0
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 3
11,740 XP
Mar
25
3 weeks ago
Activity icon

Replied to How To Assign Array Value Based On Key To A Class Public Properties?

The error show Typed property ...::$customer must be an instance of .....\Entities\Customer, array used

Activity icon

Started a new Conversation How To Assign Array Value Based On Key To A Class Public Properties?

I have a class with public properties.

public string $id;
public Customer $customer;

I have an array

$data =
 ['id' => 1,
 ['customer' => [........]
 ]


    protected function transform(array $data): void
    {
        foreach ($data as $key => $value) {
            $this->$key = $value;
        }
    }

How can i assign into the Customer with the loop above?

Mar
22
3 weeks ago
Activity icon

Started a new Conversation How To Assign Value Based On Key Without Needed To Assign One By One?

I have a class

class user() {
public string $id;
public string $first_name;
public string $last_name;
}

I want to assign value into user() based on the array i get

$array = [
'id' => 1,
'first_name' => 'james'.
'last_name' = > 'tan'
]

$user = new user();
$user->id = .....;

Is there a way used to map automatically without needed to reassign?

Mar
17
1 month ago
Activity icon

Started a new Conversation How To Prevent User From A Group To Access Other Group Resources?

I am implement API with passport, whoever own the bearer token can access to any user resource with the API.

E.g. order/1 , which belong to user A in company A but user B from other company also can access as long as got their own bearer token.

How could i restrict only to a group of user from a company which allow to view the order?

What is the method used to restrict resources being retrieved by others for api?

Mar
14
1 month ago
Activity icon

Started a new Conversation How To Convert Camel Case Into Snake Case When Store Into Database As Json?

I have an entity as shown below

class Entity {

public string uuid;
public string customerName;
......
}

In my controller

$data = collect(new Entity (
'b5b436f6-7a8b-4a5b-ae59-3754517d4ada'
'John'
))->toJson();

When converted into json, it will show {"uuid":"b5b436f6-7a8b-4a5b-ae59-3754517d4ada", "customerName":"John"}', i want it to be {"uuid":"b5b436f6-7a8b-4a5b-ae59-3754517d4ada", "customer_name":"John"}'

Mar
11
1 month ago
Activity icon

Replied to I Am Trying To Inject My Route Params Into My Model But Show 404

I am using passport, not sure why not working. Is my params wrong defined wrong so not able to do injection

Activity icon

Started a new Conversation I Am Trying To Inject My Route Params Into My Model But Show 404

This is my route

DELETE |  /api/v1/order/{order} 

I am passing my id /api/v1/order/1 to delete function in my controller

In my controller, i am using

use App/Models/OrderEvents as Order

public function delete(Order $order) {}

Am i doing in wrong way? It shows me 404 after i call my api.

Mar
09
1 month ago
Activity icon

Replied to Can Laravel Event Sourcing (spatie) Create Multiple Snapshots Table?

so meaning that i am wrong and can't use this method to achieve something like order event history? Instead of storing it in 1 snapshot table. I store it separately based on the event happened.

Activity icon

Replied to Can Laravel Event Sourcing (spatie) Create Multiple Snapshots Table?

to store snapshot for order like purchase, sale, invoice...etc in separate table

Activity icon

Started a new Conversation Can Laravel Event Sourcing (spatie) Create Multiple Snapshots Table?

Is there possible for laravel event sourcing (spatie) package to use multiple snapshots table or events table? It looks like config there only able bind to only one snapshot repo and event repo. Anyone tried before?

Mar
05
1 month ago
Activity icon

Replied to Which Approaches Better For REST API Params?

How about for product with price? Pass price as well then backend to verify if not same then throw price updated?

Activity icon

Started a new Conversation Which Approaches Better For REST API Params?

If i want store data as history. Should i pass only the id field and then retrieve record based on id, or pass all the info needed and store it in database? Which one is correctly being used?

Mar
04
1 month ago
Activity icon

Replied to How To Delete S3 Image In Feature Test?

but then it seems not detected when i am doing destroy image test, where the image not found with s3 url path provided. I have to use disk('s3') instead of fake('s3')

Activity icon

Started a new Conversation How To Delete S3 Image In Feature Test?

In my feature test was using Storage::fake('s3'), but when calling my api to delete the image then it will throw error as my API using Storage::disk('s3')->delete($path).

Any idea how i can achieve this?

Jan
25
2 months ago
Activity icon

Replied to How To Reset Back To Initial Value When Clicked Cancel?

May i know how it works? I am quite new to vue yet. Thanks if you could provide some working sample. Thanks.

Activity icon

Replied to How To Reset Back To Initial Value When Clicked Cancel?

I am not sure how should i store initial state value for v-model, and prevent changing when user are not clicked cancel button to close modal.

Activity icon

Started a new Conversation How To Reset Back To Initial Value When Clicked Cancel?

I have a modal as shown below

<div id="accordion" class="accordion">
                            <div class="card bg-grey-transparent-1" v-for="(translation, index) in value.translations" :key="index">
                                <div class="card-header bg-grey-transparent-2 pointer-cursor d-flex align-items-center collapsed" data-toggle="collapse" :data-target="`#translation-${index}`">
                                    <i class="fa fa-circle fa-fw text-blue mr-2 f-s-8"></i> {{ translation.locale }}
                                </div>
                                <div :id="`translation-${index}`" class="collapse" data-parent="#accordion">
                                    <div class="card-body">
                                        <div class="form-group">
                                            <label>{{ $trans('json.name') }}</label>
                                            <input type="text" v-model.trim="translation.name" class="form-control" />
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

this is my js

export default {
    components: { ChangesTracker },
    props: {
        value: { required: true, type: Object },
    },
    data() {
        return {
            errors: {},
        }
    },
    methods: {
        
        handleErrors(response) {
            ErrorHandler.parse(this.value, response, (errors) => {
                this.errors = errors;
            });
        },
        onReset() {
            this.errors = {};
        },
    }
}

For example, i passed test into the modal and input field show test,

When i am changing it to test abc, and then i closed the modal, but the value still there. I want to reset it back to initial value test. How can i do that?

Jan
20
2 months ago
Activity icon

Started a new Conversation Laravel Translatable Unable To Update 'en' Locale

I have an issue when updating a model translatable with this package Astrotomic/laravel-translatable

  foreach ($translations as $translation) {
	  $attribute->translateOrNew($translation['locale'])->name = $translation['name'];
 }
	$attribute->save();

I tried update every locale but only en not working when trying to update it.

Other locale working fine just en not working when trying to update. Is there anything caused this issue?

Jan
19
2 months ago
Activity icon

Started a new Conversation What Caused Table Cell Value Value Changed When There's Value Changed In Modal Input

I have a table

<template v-if="!loading">
                <table class="table table-bordered mb3" v-if="productAttributes.length > 0">
                    <thead>
                        <tr>
                            <th>{{ $trans('json.attribute') }}</th>
                            <th>{{ $trans('json.value') }}</th>
                            <th class="fit"></th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="(attr, index) in productAttributes" :key="index">
                            <td>{{ attr.name }}</td>
                            <td>{{ attr.value }}</td>
                        </tr>
                    </tbody>
                </table>
            </template>

And this is my modal

<div class="form-group">
                            <label>{{ $trans('json.value') }} <span class="text-danger">*</span></label>
                            <input type="text" v-model.trim="attribute.value" class="form-control" :class="{ 'is-invalid': 'value' in errors }" />
                            <div class="invalid-feedback">{{ errors.value }}</div>
                        </div>

When i add v-model.trim="attribute.value" then my table cell for attr.value also will changes accordingly to what i am typing in modal input for attribute.value. May i know what caused this as i am not using any keyup?

Sorry for my question, it would be if anyone would share with me the problem or experience. Thanks.

Jan
07
3 months ago
Activity icon

Replied to Unable To Execute Command With Command Handler

What if i am calling command then trigger handler? Not the right way?

Activity icon

Started a new Conversation Unable To Execute Command With Command Handler

My Command file as shown below

class RemoveWishlistCommand
{
    /** @var string */
    private $userId;

    /** @var string */
    private $applianceId;

    /**
     * RemoveWishlistCommand constructor.
     * @param string $userId
     * @param string $applianceId
     */
    public function __construct($userId, $applianceId)
    {
        $this->userId = $userId;
        $this->applianceId = $applianceId;
    }

    /**
     * @return string
     */
    public function getUserId()
    {
        return $this->userId;
    }

    /**
     * @return string
     */
    public function getApplianceId()
    {
        return $this->applianceId;
    }
}

My Command Handler file as shown below

class RemoveWishlistCommandHandler
{
    /** @var  WishlistRepository */
    private $wishlistRepository;

    /** @var EmitterInterface */
    private $emitter;

    /**
     * RemoveWishlistCommandHandler constructor.
     * @param WishlistRepository $wishlistRepository
     * @param EmitterInterface $emitter
     */
    public function __construct(WishlistRepository $wishlistRepository, EmitterInterface $emitter)
    {
        $this->wishlistRepository = $wishlistRepository;
        $this->emitter = $emitter;
    }

    /**
     * @param RemoveWishlistCommand $command
     */
    public function handle(RemoveWishlistCommand $command)
    {
        $wishlist = $this->wishlistRepository->findByUserId(UserId::fromString($command->getUserId()));
        $wishlist->removeAppliance(ApplianceId::fromString($command->getApplianceId()));
        $this->wishlistRepository->save($wishlist);
    }
}

And then i am calling this in my Controller

 $this->dispatch(new RemoveWishlistCommand($userId, $applianceId));

I am getting Call to undefined method App\Commands\RemoveWishlistCommand::__invoke() error when trying to play around with command based implementation. Am i missing some declaration on something to make it works?

Dec
14
4 months ago
Activity icon

Replied to Serialization Of 'closure' Is Not Allowed In Job

Yeah,

 $class = new class () extends FormRequest {
        };

If i am using $request->all(), then it will merge with the function above, then caused Serialization of '[email protected]' is not allowed.

If i am passing just $request, then it will just pass Serialization of Closure is not allowed.

Why some of the local environment able to proceed but some are not and throwing the error above?

App\Abstracts\[email protected] {#1657
  #container: null
  #redirector: null
  #redirect: null
  #redirectRoute: null
  #redirectAction: null
  #errorBag: "default"
  #validator: null
  #json: null
  #convertedFiles: null
  #userResolver: null
  #routeResolver: null
  +attributes: Symfony\Component\HttpFoundation\ParameterBag {#1680
    #parameters: []
  }
  +request: Symfony\Component\HttpFoundation\ParameterBag {#1673
    #parameters: []
  }
  +query: Symfony\Component\HttpFoundation\InputBag {#1681
    #parameters: array:25 [
      "company_id" => 6
      "vendor_id" => 1
Activity icon

Replied to Serialization Of 'closure' Is Not Allowed In Job

In my Job

   public function __construct($request)
    {
        $this->request = $this->getRequestInstance($request);
    }

My job class

abstract class Job implements ShouldQueue
{
    use InteractsWithQueue;
    use Jobs;
    use Queueable;
    use Relationships;
    use SerializesModels;

    public function getRequestInstance($request)
    {
        if (!is_array($request)) {
            return $request;
        }

        $class = new class () extends FormRequest {
        };

        return $class->merge($request);
    }
}

The error happen after call $this->getRequestInstance($request);. And yes I am using PHP 7.4

Activity icon

Replied to Serialization Of 'closure' Is Not Allowed In Job

If i just $request->query(), it returns me Serialization of '[email protected]' is not allowed in file /var/www/vendor/laravel/framework/src/Illuminate/Queue/Queue.php on line 147, Is it correct, i already pass specific params.

Activity icon

Started a new Conversation Serialization Of 'closure' Is Not Allowed In Job

I am calling this function in my controller

 $response = $this->ajaxDispatch(new CreateOrder($request));

and then in my job

   public function __construct($request)
    {
        $this->request = $request;
    }

I am getting the error as shown in title when trying different local environment.

May i know what's the issue and how to solve it?

Dec
10
4 months ago
Activity icon

Started a new Conversation How Can I Clone Row And Relationship Into Another Table?

I am doing in this way, to clone row

            $old = $order->replicate();
            $old = $order->toArray();
            $new->create($old);

But how if i want to clone the relationship for $order as well?

My relationship e.g. hasMany => items(), hasMany => history()

How can i clone it also?

Nov
30
4 months ago
Activity icon

Replied to Laravel Module Package Not Working With Factory

This is my OrderFactory

namespace Modules\Order\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use Modules\Order\Entities\Order;

class OrderFactory extends Factory
{
    protected $model = Order::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        return [
            'order_number' => Str::random(10),
            'company_name' => $this->faker->name,
        ];
    }
}

Activity icon

Started a new Conversation Laravel Module Package Not Working With Factory

Is there anyone having issue when calling factory class?

php artisan db:seed --class=\\Modules\\Order\\Database\\Seeders\\OrderDatabaseSeeder

After calling the command above i get the error as shown below,

Class 'Database\Factories\Modules\Order\Entities\OrderFactory' not found

  at vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/Factory.php:674
    670▕     public static function factoryForModel(string $modelName)
    671▕     {
    672▕         $factory = static::resolveFactoryName($modelName);
    673▕ 
  ➜ 674▕         return $factory::new();
    675▕     }
    676▕ 
    677▕     /**
    678▕      * Specify the callback that should be invoked to guess factory names based on dynamic relationship names.

      +1 vendor frames 
  2   database/seeders/OrderDatabaseSeeder.php:17
      Modules\Order\Entities\Order::factory()

      +22 vendor frames 
  25  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
[email protected]:/var/www# php artisan db:seed --class=\Modules\Order\Database\Seeders\OrderDatabaseSeeder

   Error 

  Class 'Database\Factories\Modules\Order\Entities\OrderFactory' not found

  at vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/Factory.php:674
    670▕     public static function factoryForModel(string $modelName)
    671▕     {
    672▕         $factory = static::resolveFactoryName($modelName);
    673▕ 
  ➜ 674▕         return $factory::new();
    675▕     }
    676▕ 
    677▕     /**
    678▕   

Anyone facing similar issue, and how to solve it? Thanks.

Nov
24
4 months ago
Activity icon

Replied to Collection Doesn't Make Changes

Okay, thanks ! My bad

Activity icon

Started a new Conversation Collection Doesn't Make Changes

I am trying to populate the $list with extra attributes as shown below

  $list = [
            'draft',
            'pending_approval',
            'pending_delivery',
            'closed',
        ];

        $statuses = collect($list)->each(function ($code) {
            $item = new \stdClass();
            $item->code = $code;
            $item->name = trans('biils.statuses.' . $code);
           
            return $item;
        });

But it seems like just turn array into collection.

Output:

Illuminate\Support\Collection {#1646 ▼
  #items: array:4 [▼
    0 => "draft"
    1 => "pending_approval"
    2 => "pending_delivery"
    3 => "closed"
  ]
}

Am i did in wrong way?

Nov
23
4 months ago
Activity icon

Started a new Conversation Too Few Arguments To Function When Calling Job

I am having my controller to call job BillCreated and passed 3 parameters to the job.

In my job controller.

    public function __construct($request, $bill, $history)
    {
        $this->request = $request;
        $this->bill = $bill;
        $this->history = $history;
    }

    public function handle()
    {
        \DB::transaction(function () {
            $this->newBill = $this->bill->create($this->request->all());

         $this->dispatch(new CreateBillItems($this->newBill, $this->request));
        })


When i am running this line $this->dispatch(new CreateBillItems($this->newBill, $this->request));,

It show me errors Too few arguments to function ...\\Jobs\\CreateBill::__construct(), 1 passed in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Bus/Dispatchable.php on line 17 and exactly 3 expected"

May i know what is going wrong from here? What is the root cause for this issue?

Nov
20
4 months ago
Activity icon

Replied to Call To Undefined Function Event()

Yeah, i don't really modify files in the vendor directory. But after composer update it looks fine. But then event() function didn't trigger any job of mine.

Activity icon

Started a new Conversation Call To Undefined Function Event()

I am trying to call event() in such way as shown below.

event(new User($user));

But it returns me Error: Call to undefined function Modules\User\Http\Controllers\API\event() in file /var/www/Modules/User/Http/Controllers/API/UserController.php on line 156

I found that the event function missing in Illuminate\Foundation\helpers.php

May I know what's wrong with this?

Nov
12
5 months ago
Activity icon

Replied to Storing Data As Json Or Separated As Column Better In Database?

Erm, what i mean i have this details like order_id, customer_id, customer_name, customer_address, etc... in my Order table. Can i store the customer_name and customer_address under json column or as separated column?

Activity icon

Started a new Conversation Storing Data As Json Or Separated As Column Better In Database?

I am using MySQL as my database. I am thinking to store user details in json type instead of create multiple column to store data. I am storing the details such as tax_number, company_name, address...etc in my order table.

May i know better to separate it out or it's fine to store as json format?

Nov
11
5 months ago
Activity icon

Started a new Conversation CORS Issue When Accessing From Local Ionic Development

I am facing a weird issue when trying to access API endpoint from mobile development. I have access two different endpoint with same project development environment.

There's one of the API endpoint showing

Access to XMLHttpRequest at 'https://......ngrok.io' from origin 'http://localhost:8100' has been blocked by CORS policy: Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response.

While the other API endpoint result expected output.

Anyone facing this issue before? Or is there related to any setting in my local machine to block the request?

Nov
08
5 months ago
Activity icon

Started a new Conversation How To Store The Images With C:\fakepath?

I am using file-preview-with-upload plugin, but i am having issue on storing the images that passed form jquery to store in my storage folder.

I get the value $request->avatar, it returns C:\fakepath\1....., while $requst->file('avatar') return null value.

How can i store the image uploaded in my storage folder?

Oct
28
5 months ago
Activity icon

Replied to Laravel Job Cant Find Event Classes

I have no idea also what's went wrong haha

Activity icon

Replied to Laravel Job Cant Find Event Classes

Actually i am using docker, i did the above steps not working. But no point right if it able to work in web.php but not in job file.

Activity icon

Replied to Laravel Job Cant Find Event Classes

Here my composer.json 's "autoload"

 "autoload": {
        "psr-4": {
            "App\": "app/",
            "Modules\": "Modules/",
            "Database\Factories\": "database/factories/",
            "Database\Seeders\": "database/seeders/"
        },
        "files": [
            "app/helpers.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Modules\": "Modules/",
            "Tests\": "tests/"
        }
    },
Activity icon

Replied to Laravel Job Cant Find Event Classes

I tried composer dump-autoload not working.

Here's the error show

[2020-10-28 01:35:21] local.ERROR: Class 'Modules\Auth\Jobs\Modules\Auth\Events\SendPing' not found {"exception":"[object] (Error(code: 0): Class 'Modules\Auth\Jobs\Modules\Auth\Events\SendPing' not found at /var/www/Modules/Auth/Jobs/SendPingJob.php:36)
[stacktrace]
#0 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Modules\Auth\Jobs\SendPingJob->handle()
#1 /var/www/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#2 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#3 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#4 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(596): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#5 /var/www/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call(Array)
#6 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Modules\Auth\Jobs\SendPingJob))
#7 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Modules\Auth\Jobs\SendPingJob))
#8 /var/www/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#9 /var/www/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(85): Illuminate\Bus\Dispatcher->dispatchNow(Object(Modules\Auth\Jobs\SendPingJob), false)
#10 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}(Object(Modules\Auth\Jobs\SendPingJob))
#11 /var/www/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Modules\Auth\Jobs\SendPingJob))
#12 /var/www/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(87): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#13 /var/www/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(60): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\RedisJob), Object(Modules\Auth\Jobs\SendPingJob))
#14 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array)
#15 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(406): Illuminate\Queue\Jobs\Job->fire()
#16 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(356): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Illuminate\Queue\WorkerOptions))
#17 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Illuminate\Queue\WorkerOptions))
#18 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(116): Illuminate\Queue\Worker->daemon('redis', 'queue', Object(Illuminate\Queue\WorkerOptions))
#19 /var/www/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(100): Illuminate\Queue\Console\WorkCommand->runWorker('redis', 'queue')
#20 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#21 /var/www/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#22 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#23 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#24 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(596): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#25 /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#26 /var/www/vendor/symfony/console/Command/Command.php(258): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#27 /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#28 /var/www/vendor/symfony/console/Application.php(920): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /var/www/vendor/symfony/console/Application.php(266): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /var/www/vendor/symfony/console/Application.php(142): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /var/www/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /var/www/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 {main}
"} 
Activity icon

Started a new Conversation Laravel Job Cant Find Event Classes

In my Job class, I unable to call my event class. It shows undefined class.

My job class as follow

<?php

namespace Modules\Auth\Jobs;

use Modules\Auth\Events\SendPing;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class SendPingJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;


    public $token;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($token)
    {
        $this->token = $token;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
     
        broadcast(new SendPing($this->token));
    }
}

When i put event into others file like web.php, it works fine.

broadcast(new SendPing($this->token));

May i know what's went wrong?

Oct
27
5 months ago
Activity icon

Started a new Conversation How To Repeating Broadcast With Event Times And Then Stop?

I want to broadcast an event every 20 secs and then stop when reached certain amount?

How can i make this happen when some of my function called then will trigger broadcast event every 20 seconds and stop after reached 5 times?

Oct
22
5 months ago
Activity icon

Replied to How Do We Match Token From Web And Mobile Apps For Authentication?

How can it be done? Mobile has it own token bind to the authenticated user. But how to validate it from web to login through web browser after using mobile scanner to scan QR code displayed?

Oct
21
5 months ago
Activity icon

Started a new Conversation How Do We Match Token From Web And Mobile Apps For Authentication?

I am doing authenticate based login method to login web from mobile.

I have implemented web socket in my project.

But how do we identify and matching both unique token from web and mobile?

Oct
20
5 months ago
Activity icon

Started a new Conversation Events Unable To Be Fired When Using Multi-tenancy

I am facing issue when trying to fire a broadcast event

 broadcast( new \Modules\Auth\Events\SendPing );

It throws error "The current tenant could not be determined in a job named Illuminate\Queue\[email protected]. No tenantId was set in the payload."

I implemented NotTenantAware in my event class, but seems not working too.

I am using https://spatie.be/docs/laravel-multitenancy/v1/introduction

May i know how to fix this issue?