Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

Crazylife

Crazylife

Member Since 3 Years Ago

Experience Points
10,660
Total
Experience

4,340 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
2
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.

Level 3
10,660 XP
Nov
24
15 hours 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
1 day 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 days 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
1 week 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
1 week 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
2 weeks 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
3 weeks 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
4 weeks 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
1 month 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
1 month 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
1 month 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?

Oct
05
1 month ago
Activity icon

Started a new Conversation What's The Appropriate Method To Be Used To Mask Id From URL?

Which general method do you guys use to mask a ID from URL?

  1. UUID
  2. HashID

Any other methods which commonly used?

Aug
27
2 months ago
Activity icon

Started a new Conversation Database Design On Relationship Between Account, Company And Department

I have 3 entity, account, company and department.

1 account can handle multiple company with multiple department. 1 account can bind to multiple department. 1 company can handle multiple department. 1 department can be assigned to multiple company and multiple account.

My idea looks like this

account -> account_department <- department
account -> account_companies <- companies
companies-> company_department <- department

Is there any issue as it looks like circular or enhancement can be made?

Jul
23
4 months ago
Activity icon

Started a new Conversation How To Download A Zip File Using Ajax?

I have written this statement to download zip file from my backend.

 return response()->download($filetopath, $zipFileName, $headers)->deleteFileAfterSend(true);

It works well without ajax, but how it works if i want to use ajax to download?

success: function (response) {
				var a = document.createElement("a");
				a.href = response.file;
				a.download = response.name;
				document.body.appendChild(a);
				a.click();
				a.remove();
			},

It shows undefined to me

Jul
22
4 months ago
Activity icon

Started a new Conversation Can I Add Pdf Generated From Dompdf Without Save To A Public Folder?

I want to add pdf file without storing in server and directly download with ZipArchieve.

Is there possible to do this?

Jul
08
4 months ago
Activity icon

Started a new Conversation How To Pass Tablename As Param Into Stored Procedure MySQL

I want to pass my table name as params into my stored procedure. I tried normal way to pass the table name like how i pass the column value but it doesn't read it as table name.

Is that possible to run it dynamically?