frankielee

frankielee

Software Engineer at Kuala Lumpur

Member Since 6 Months Ago

Kuala Kangsar

Experience Points
27,310
Total
Experience

2,690 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
33
Lessons
Completed
Best Reply Awards
38
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 6
27,310 XP
Sep
25
2 days ago
Activity icon

Replied to Laravel Jetstream Profile-photos Not Showing

All the files are stored under /project/storage/ , the storage under /public/storage is the shortcut of the /project/storage/ folder which created by php artisan storage:link

Sep
24
3 days ago
Activity icon

Replied to Laravel Jetstream Profile-photos Not Showing

Is the profile picture stored successfully?

(Window) If yes, these are the steps I fixed it:

  1. Delete the shortcut folder storage created at /project/public/
  2. Use the command php artisan storage:link again
  3. Refresh the webpage and it solved.
Activity icon

Replied to Return Last Record By Forign_key

Instead of ordering by id, you should order it by using the DateTime column?

Example: If the updated_at will update if selected by the student, you should order by the updated_at

Change this 
orderby('id', 'DESC')

to

orderby('updated_at', 'DESC')
Activity icon

Replied to API Resource With Pagination

Weird, I have no issue at first, the issue only comes after I adding the code below.


ResourceCollection::withoutWrapping();

Activity icon

Replied to Forget My Password

If you have set up the Mailhog, you can view all the emails at http://localhost:8025

https://laravel.com/docs/8.x/homestead#configuring-mailhog

Sep
23
4 days ago
Activity icon

Awarded Best Reply on Factory Created_at

In the factory class, you can initialize the $date before return.

Example

    public function definition()
    {
	$date = $this->faker->dateTimeBetween('-1 day' );
        return [
		'created_at'=>$date,
		'updated_at'=>$date
        ];
    }

Activity icon

Replied to Factory Created_at

In the factory class, you can initialize the $date before return.

Example

    public function definition()
    {
	$date = $this->faker->dateTimeBetween('-1 day' );
        return [
		'created_at'=>$date,
		'updated_at'=>$date
        ];
    }

Activity icon

Replied to Factory Created_at

My mistake, use string instead

        'created_at'=>$this->faker->dateTimeBetween("-1 day" , now()),

Activity icon

Replied to Factory Created_at

The method is built-in with Faker.

You have to code like this in Laravel 8


'created_at'=> $this->faker->dateTimeBetween(-1, now()),

Activity icon

Replied to Factory Created_at

https://github.com/fzaninotto/Faker#fakerproviderdatetime

$faker->dateTimeBetween('-20 days', now());
Activity icon

Replied to I Have A Request Data But Doesn't Updated In My Database

If possible, just show your controller and model here.

Activity icon

Replied to I Have A Request Data But Doesn't Updated In My Database

primary key should not be fillable, you can try to code like this:

$validatedData = $this->validate($request, [
            'name' => 'required'
        ]);

  $data = $moneyTransfer->update($validatedData);
        \Log::info($validatedData);

Sep
22
5 days ago
Activity icon

Awarded Best Reply on Old Data Recreating Every Time A New Data Is Entered In Model

Because you are calling the insert method every time?

This line

 $income = Income::create(['project_name_id' => $bill->project_name_id, 'income_amount'=>$prj->remaining_money - $bill->remaining]);

Maybe you should firstOrCreate() ? https://laravel.com/docs/7.x/eloquent#other-creation-methods

Activity icon

Replied to Old Data Recreating Every Time A New Data Is Entered In Model

Because you are calling the insert method every time?

This line

 $income = Income::create(['project_name_id' => $bill->project_name_id, 'income_amount'=>$prj->remaining_money - $bill->remaining]);

Maybe you should firstOrCreate() ? https://laravel.com/docs/7.x/eloquent#other-creation-methods

Sep
21
6 days ago
Activity icon

Replied to GIT Pushing

if you are not familiar with those git commands, maybe you can use the source tree. https://www.sourcetreeapp.com/

Activity icon

Replied to Modal Is Closing (3 Seconds) When I'm In Edit Form

Does the page refreshed, or nothing happens (including event is triggered) except the modal closes automatically after 3 seconds?

Activity icon

Replied to Modal Is Closing (3 Seconds) When I'm In Edit Form

perhaps you can show the modal code?

Activity icon

Replied to Password Setter Problem

Wow, I didn't even know there is a method like this before. Thanks sir.

Activity icon

Awarded Best Reply on Variable In Blade Component Name

Hi, I did accomplish something like that. You can first create a component class and assign the type in the render method.

Example: php artisan make:component Activities

Component Class

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

    }

public function render(){
	return view('profile.activities.'.$this->activity->type);
}

View blade.php

<x-activities :activity="$activity"/>
Activity icon

Replied to Modal Is Closing (3 Seconds) When I'm In Edit Form

Use <button> instead. The website will redirect every time you click on the <a> hyperlink


<button type="button" class="btn btn-primary " @click="editMoneyTransfer(moneytrans)" >
            <i class="fa fa-edit"></i>
            &nbsp;Edit
 </button>
Activity icon

Replied to Password Setter Problem

@sagar001 Please try to do this checking for both registration and edit. Only unhashed will return algo as null

https://imgur.com/a/edR5UxN

Activity icon

Replied to Password Setter Problem

@sagar001 try this

https://www.php.net/manual/en/function.password-get-info.php

public function setPasswordAttribute($value)
{
    if(filled($value)){
        info('original : ' . $value);
        if (filled(password_get_info($value)['algo'])) {
            $value = bcrypt($value);
            info('bcrypted : ' . $value);
        }
        $this->attributes['password'] = $value;
    }
}

Activity icon

Replied to Password Setter Problem

Hi @sagar001, I have tested the code and it's only hashed once on my end.

The log: https://imgur.com/a/QxHQGhU

The code

    public function setPasswordAttribute($value)
    {
	if(filled($value)){
        info('original : ' . $value);
        if (request()->has('crypt') && request('crypt') === true) {
            $value = bcrypt($value);
            info('bcrypted : ' . $value);
        }
        $this->attributes['password'] = $value;
}
    }
Activity icon

Replied to Strange Issue With Wire:model

You have to set the forwarding events :

Example

<input wire:model="name"   onchange="this.dispatchEvent(new InputEvent('input'))"/>

Or you can refer to this https://laravel-livewire.com/docs/2.x/properties#lazy-updating

Activity icon

Replied to Strange Issue With Wire:model

Wrong Method name, there is no method call update in livewire

https://laravel-livewire.com/docs/2.x/lifecycle-hooks

Activity icon

Replied to Get 500 Internal Error In Submit

I think the error might be undefined variable $money trans

Try to initialize the variable before the try-catch

Also, why you use $this->validate Please refer https://laravel.com/docs/8.x/validation#quick-writing-the-validation-logic

 $moneytrans = [] ;
 try {
            $request->validate($request, [
                'name' => 'required'
            ]);
            // dd($request);
            $moneytrans = MoneyTransfer::create($request->all());
        } catch(Exception $e) {
            session()->flush('error', $e->getMessage());
        }
        return $moneytrans;
        session()->flash('save', 'Money transfer added.');
Activity icon

Replied to API Not Working With Laravel 8

In the Clients model class, please make sure the variable pushtoken is added into the $fillable array

Example

protected $fillable = ['pushtoken'];

https://laravel.com/docs/8.x/eloquent#mass-assignment

Sep
20
1 week ago
Activity icon

Replied to Password Setter Problem

if(!request->has('password') || blank(request('password')){  //ignore if null or not passed
	return;
}

if(request('pleaseCrypt')===true)){
	$value = bcrypt($value);
}
//the value already crypted and not empty
$this->attributes['password'] = $value;

Activity icon

Replied to Password Setter Problem

//set a condition, if true then proceed
if(request('setPassword')===true){
return $this->attributes['password'] = bcrypt($value);
}
}
Sep
19
1 week ago
Activity icon

Replied to Route [blog.list] Not Defined.

@letmeknow your issue solved after clearing the cache?

Activity icon

Awarded Best Reply on Route [blog.list] Not Defined.

try to run these commands

php artisan route:list //to check the list of routes registered

php artisan optimize:clear // to clear all the caches

Activity icon

Replied to Route [blog.list] Not Defined.

try to run these commands

php artisan route:list //to check the list of routes registered

php artisan optimize:clear // to clear all the caches

Sep
16
1 week ago
Activity icon

Awarded Best Reply on [delete Me]

Just marks your own reply as the best answer

Activity icon

Replied to [delete Me]

Just marks your own reply as the best answer

Activity icon

Replied to Dependent Dropdown With API

What is your issue? Perhaps open a new thread with a briefly description is better?

Sep
15
1 week ago
Activity icon

Replied to Vue Axios Response Return Empty Formdata Post Http Request Is Working Fine

How about try to dd($category) and check what will return?

Activity icon

Replied to Variable In Blade Component Name

Hi, I did accomplish something like that. You can first create a component class and assign the type in the render method.

Example: php artisan make:component Activities

Component Class

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

    }

public function render(){
	return view('profile.activities.'.$this->activity->type);
}

View blade.php

<x-activities :activity="$activity"/>
Sep
14
1 week ago
Activity icon

Replied to Laravel 8 Team::factory() Not Found

The current_team_id is nullable, Laravel will only update it only after you have login successfully. If you have previously selected Team and stored in the database, the team will be the default selected. You will need to create a team after the user is created.

  1. It's up to you. An example use case will be you have multiple projects which including different members, you will need it.

  2. Maybe you don't need the team module at all?

Activity icon

Replied to Laravel 8 Team::factory() Not Found

factory(App\Models\Team::class)->create()->id instead?

Activity icon

Replied to How To Translate Validation Into Request Rules Validation

https://laravel.com/docs/5.8/validation#creating-form-requests

public function withValidator($validator)
{
    $validator->after(function ($validator) {
        if ($this->somethingElseIsInvalid()) {
                   flash()->error('You have missing fields.');
        }
    });
}
Activity icon

Replied to Vue Axios Response Return Empty Formdata Post Http Request Is Working Fine

How does your route look like in the web,php?

Controller


public function update(Request $request, $id)
  {
	if(blank($id)){
		return "id is empty";
	}
        
$category = Category::findOrFail($id); // will return 404 if category not found
        return $category;
    }


Activity icon

Replied to Vue Axios Response Return Empty Formdata Post Http Request Is Working Fine

In your Axios

Add catch for the error

axios.put('category/'+id,data,{ headers: { 'Content-Type': 'multipart/form-data' } })
            .then(res=>{
                 console.log(res);
            }),catch(res=>{
			console.log('error',res);
		});

Controller

You should return the $category instead of $request

public function update(Request $request, $id)
    {
        $category = Category::find($id);
        return $category;
    }

Sep
13
2 weeks ago
Activity icon

Awarded Best Reply on How Do You Make Multiple Authentication In Laravel 8?

Seems like they have updated their documentation, you need to specify the laravel/ui version

https://laravel.com/docs/7.x/authentication#included-routing

composer require laravel/ui "^2.4"

After that, you should have no issue running php artisan ui bootstrap

Edit:

laravel/ui is still available in Laravel 8, you can still download and use it.

Activity icon

Replied to Deploy Database Changes To Production Server

Since you are using Laravel Framework, you can just use the migration

https://laravel.com/docs/8.x/migrations#introduction

I will create all the tables and modification by using the command

php artisan make:migration _____

And just run the command php artisan migrate to update the changes

Activity icon

Replied to SQLSTATE[42S01]: Base Table Or View Already Exists

Your migrations table does not find the value 2014_10_12_100000_create_password_resets_table, the command try to migrate the table again although it had been created before.

Activity icon

Replied to How Do You Make Multiple Authentication In Laravel 8?

Seems like they have updated their documentation, you need to specify the laravel/ui version

https://laravel.com/docs/7.x/authentication#included-routing

composer require laravel/ui "^2.4"

After that, you should have no issue running php artisan ui bootstrap

Edit:

laravel/ui is still available in Laravel 8, you can still download and use it.