Ranx99

Ranx99

Member Since 2 Years Ago

Experience Points
4,660
Total
Experience

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
6
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 1
4,660 XP
Sep
20
4 days ago
Activity icon

Replied to Make Sure Vimeo Has Completed Transcoding Of Video On Uploading

@smoketm I have a similar case, just curious on how did you solve the issue? since Vimeo doesn't support webbooks

Aug
01
1 month ago
Activity icon

Started a new Conversation Domain Emails?

What service do you guys use to have emails such as:

[email protected] [email protected]

Jul
30
1 month ago
Activity icon

Replied to Cant Delete An Image

OK now it doesn't show up ... I didn't do anything! but maybe it needs time for everything to be updated?

Activity icon

Replied to Cant Delete An Image

I am testing forge to the first time, does forge enable that by default?

Activity icon

Replied to Cant Delete An Image

tried that.. I also tried another browser... and restarted nginx and php ..

Activity icon

Started a new Conversation Cant Delete An Image

I have an image in public/images/logo.svg

When I delete the image through SSH, It still shows up when visiting the website... I also tried to delete the whole images folder and the image still shows up when visiting the website still...

what am I missing here?

Jul
26
1 month ago
Activity icon

Replied to Laravel Forge Support?

@briankidd thanks for your help, they responded to me.

It seems they don't have weekend hours.

Activity icon

Started a new Conversation Laravel Forge Support?

I cant login to my account in Forge.

I have tried to reach out to the support of Forge yesterday through the circle in the lower right corner but without any response yet, I am not sure If my messages are going to them or not..

Do they have an email to contact them directly? or is there another way?

  • this is URGENT
Jul
10
2 months ago
Activity icon

Replied to Is This Secure? Why?

What if a malicious user ( Person A ) has a twitter ,facebook or github account with an email that exists in my website for Persion B, then does that mean that Person A will login to the website into Persion B account based on that line of code?

Is this something can happen?

Activity icon

Started a new Conversation Is This Secure? Why?

I am following this tutorial to implement social login: https://www.sitepoint.com/easily-add-social-logins-to-your-app-with-socialite/

Everything works fine, but I am having trouble in understanding this code:

$user = User::where('email', $providerUser->getEmail())->first();

What's happening here? Is this secure against a malicious user?

Jul
06
2 months ago
Activity icon

Replied to How To Test A Failing Job Code

dispatchNow doesnt work here also:

The failed method will not be called if the job was dispatched using the dispatchNow method.

I tried to use dispatch($mock), but I am getting Exception: Serialization of 'ReflectionClass' is not allowed error.

Activity icon

Started a new Conversation How To Test A Failing Job Code

I have this job:

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

    public $file;

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

    public function handle()
    {
        $this->file->update([
            'status' => 'procssing',
        ]);

        $this->start();

        $this->file->update([
            'status' => 'success',
        ]);
    }

    public function failed(Exception $exception)
    {
        $this->file->update([
            'status' => 'un-procssed',
        ]);
    }

    protected function start()
    {
        return true;
    }
}

I am trying to test the code in the failed method:

/** @test */
public function it_will_set_status_to_un_procssed_when_failing()
{
    $file = factory(File::class)->create();

    $mock = Mockery::mock(ProcessFileJob ::class, [$file])->shouldAllowMockingProtectedMethods()->makePartial();
    $mock->shouldReceive('start')->once()->andThrow(new CustomException('test'));

    $mock->handle($file);

    $this->assertEquals('un-processed', $file->fresh()->status);
}

but this will always throw the CustomException and the test will fail.. even If I use withExceptionHandling method. I just want to test the code in the failed method to make sure when the job is failed the status of the file will change.

May
28
3 months ago
May
17
4 months ago
Activity icon

Replied to Select Specific Fields By Polymorphic Type While Using 'with'?

Yes that needs all the related tables has the same fields, so If articles table has a reading_time field, the videos table must have a reading_time for this to work.

Is there any workaround out there for this case?

May
16
4 months ago
Activity icon

Started a new Conversation Select Specific Fields By Polymorphic Type While Using 'with'?

class Lesson extends Model
{
    public function content()
    {
        return $this->morphTo();
    }
}
Schema::create('lessons', function (Blueprint $table) {
    $table->id();
    $table->unsignedBigInteger('channel_id');
    $table->string('title');
    $table->nullableMorphs('content');
    $table->timestamps();

    $table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
});
Schema::create('videos', function (Blueprint $table) {
    $table->id();
    $table->string('title');
    $table->string('size');
    $table->string('path');
    $table->timestamps();
});
Schema::create('articles', function (Blueprint $table) {
    $table->id();
    $table->string('body');
    $table->string('reading_time');
    $table->timestamps();
});

A lesson can have a Video or an Article as a content, now everything works fine, But I am having a trouble in selecting specific fields while eager loading the content.

Channel::whereId($channelId)->with(['lessons'=> function ($query) {
    $query->with('content:id,size');
}])->first();

Since Lesson content can be Video or an Article an error will be shown:

Column not found: 1054 Unknown column 'size' in 'field list' (SQL: select `id`, `size` from `articles` where `articles`.`id` in (168))

How can I the fields I want while eager loading based on the polymorphic relation type?

May
02
4 months ago
Activity icon

Replied to Posts Approvals?

@snapey

So, I will focus only at the latest approval request for a post, then when admin approves the approval, the status of the post will be updated to published?

Activity icon

Started a new Conversation Posts Approvals?

I am trying to implement this scenario:

Posts can have publish and draft as a status

Author dashboard:

  1. User creates a post.
  2. Show disapproved comment for old approval request if any ( related to step 3 in Admin dashboard).
  3. User asks for an approval request for his post.

Admin dashboard:

  1. User can see all approval requests that needs to be reviewed
  2. User can ( approve - disapprove )
  3. If he disapprove he can give a comment on why it was disapproved.
  4. If he approves the post will be published.

While trying to implement this, someone directed me use to the following database structure:

Schema::create('approvals', function (Blueprint $table) {
    $table->id();
    $table->morphs('approvable');
    $table->tinyInteger('status'); // approved - disapproved - under-review
    $table->text('comment')->nullable();
    $table->timestamps();
});
Schema::create('courses', function (Blueprint $table) {
    $table->id();
    $table->unsignedBigInteger('user_id');
    $table->string('title');
    $table->text('body');
    $table->tinyInteger('status'); // published - draft
    $table->timestamps();

    $table->foreign('user_id')->references('id')->on('users');
});
  • Do I really need the status field in courses table? isn't the status in approvals is enough?
  • Is there any package out there that I can take inspiration from to implement this?
Apr
28
4 months ago
Activity icon

Started a new Conversation Which Money Datatype To Use ?

If I am building an e-commerce application, which datatype is best to for price field?

  • should I use integer and store everything as cents? or use decimal?

  • is there any disadvantage of using decimal?

Apr
09
5 months ago
Activity icon

Started a new Conversation Job' RetryUntil Doesn't Work For Some Reason

I have this job which uses retryUntil

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

    public function handle()
    {
        throw new \RuntimeException('oops');
    }

    public function retryUntil()
    {
        return now()->addSeconds(5);
    }
}

When I run this job I am expecting that, when it fails it will run again and again until 5 seconds are over. But it only runs one time. why?

enter image description here

Apr
08
5 months ago
Activity icon

Started a new Conversation How To Test A Job When It Fails?

I want to make sure that a job will be re-tried after x minutes when it fails:


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

    public $retryAfter = 300;

    public function handle()
    {
	    //code
    }
}

So if I have the above job, how can I test that it will be retried after 5 minutes when it fails?