frankielee

Software Engineer at Kuala Lumpur

Member Since 10 Months Ago

Kuala Kangsar

Experience Points
30,430
Total
Experience

4,570 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
34
Lessons
Completed
Best Reply Awards
42
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 7
30,430 XP
Dec
24
4 weeks ago
Activity icon

Awarded Best Reply on Table Plus - Homestead, How To Connect?

No, I have never used before. Based on the error you post, probably due to database not created. What is the original value for the first time you ran homestead up?

Activity icon

Replied to Table Plus - Homestead, How To Connect?

No, I have never used before. Based on the error you post, probably due to database not created. What is the original value for the first time you ran homestead up?

Activity icon

Replied to Table Plus - Homestead, How To Connect?

There should be a configuration named "databases", you can list down all the databases you want, and it will auto-create it for you

Example:

databases:
    - project1
Activity icon

Replied to Table Plus - Homestead, How To Connect?

Check your Homestead.yaml or any docker file.

Check the IP configuration you set,

Example

ip: 192.168.10.10
memory: 2048
cpus: 2

Your MySQL

Name: Homestead
Host: 192.168.10.10
Username: homestead
Password: secret
Database: project1
Port: 3306
Nov
18
2 months ago
Activity icon

Replied to Update User Table

Maybe you can try mutator, https://laravel.com/docs/8.x/eloquent-mutators#defining-a-mutator

Example

public function setPasswordAttribute(){
	$password = request()->has('password') ? Hash::make(request('password')) : auth()->user()->password;


	 $this->attributes['password'] = $password;
}
Oct
25
2 months ago
Activity icon

Replied to UpdateOrCreate Not Working

Well, it is pretty clear from the documentation. I hope you will spend some time reading it.

https://laravel.com/docs/7.x/eloquent#other-creation-methods

Oct
18
3 months ago
Activity icon

Replied to How To Store BelongsToMany?

@vector_rashed The thread was marked solved, and now it's removed.

@oxbir why the best answer is removed? Your issue is not solved yet?

Oct
09
3 months ago
Activity icon

Replied to How To Store BelongsToMany?

Excuse me, you want the foreign key named as user_id or skill_user_id??

If you want named it as skill_user_id, just rename the column user_id to skill_user_id

Activity icon

Replied to How To Store BelongsToMany?

Hey @oxbir, these steps might solve your issue.

1. run command php artisan make:migrate create_skill_user_user_table
2.  copy and paste these things

        $table->bigIncrements('id');
        $table->bigInteger('user_id')->unsigned();
        $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
        $table->string('name');
        $table->smallInteger('level');
        $table->timestamps();

3. execute PHP artisan migrate
Activity icon

Replied to How To Store BelongsToMany?

I can't really understand what are you doing. From my understanding, the relationship should be One to Many instead of Many to Many.

Anyway, just duplicate the migration file of 'skill_user' and rename it to 'skill_user_user' to migrate it.

Activity icon

Replied to How To Store BelongsToMany?

The skill_user_user hasn't created yet in your resumes database.

Activity icon

Replied to 422 (unprocessable Entity) Laravel Nuxt Js Error

Assign data to the variables, do not leave them empty

Oct
07
3 months ago
Activity icon

Replied to Routing With Livewire

You can do whatever you want.

For example, just return the livewire if you want.

return view('livewire.your view');
Oct
06
3 months ago
Activity icon

Replied to Project Setup On DigitalOcean Npm Errors

npm run prod or npm run production will create the app.css and app.js files in the /projects/public/, it will minimize the CSS and js size. For example, app.css will only involve the styling used in your projects.

Activity icon

Replied to Project Setup On DigitalOcean Npm Errors

To be honest, I am not that familiar with npm either, the trick that solved my issue is just executing the command sudo npm run prod.

Maybe you can try to clear the cache also.

Activity icon

Replied to Project Setup On DigitalOcean Npm Errors

Check the file package.json, you probably saw things like below, change --no-progress to --progress

    "scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "npm run development -- --watch",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
Activity icon

Replied to Project Setup On DigitalOcean Npm Errors

Hmm, maybe you can enable the progress bar, so that you can know the failure occur in which stage. For example, if you stuck or fail at 92% chuck optimization bla bla bla, it probably due to directory permission issue

Activity icon

Replied to Project Setup On DigitalOcean Npm Errors

have you tried the command sudo npm run prod ?

Activity icon

Replied to Image On Email Not Showing

Please use a valid domain or IP address to do the testing. Only you yourself can access to the localhost

Oct
05
3 months ago
Activity icon

Replied to Laravel 8: Phpunit Giving Error On Test

https://laravel.com/docs/8.x/database-testing#resetting-the-database-after-each-test

If RefreshDatabase is in used, the database will be cleared after finished executing every test(method).

Activity icon

Replied to Search Not Work Laravel 8x + Livewire

Every valid tag like div, p, table, etc. is considered as an element.

The root element is the top-level element, for example, input and table are the root elements in your file.

Oct
04
3 months ago
Activity icon

Replied to Storage Folder Is Not Showing In The Public Folder After Linking The Path

Check this link. https://laravel.com/docs/8.x/filesystem#the-public-disk

By default, only storage/app/public/ is served as the public directory.

Those files stored in storage/app will be served as private files.

Activity icon

Replied to Storage Folder Is Not Showing In The Public Folder After Linking The Path

It will only link the directory that viewable publicly, which is storage/app/public.

Activity icon

Awarded Best Reply on Test API Token Authorization:Bearer

Check this link https://laravel.com/docs/7.x/http-tests#customizing-request-headers

Example

$ response = $ this->withHeaders(['Authorization'=>'Bearer '.$token)->post ('api / store', $ data);
Activity icon

Replied to Test API Token Authorization:Bearer

@gianmarx

If you are excepting the response is in JSON format, please add this to the header

Example

$response = $this->withHeaders(['Authorization'=>'Bearer '.$token,
							    'Accept' => 'application/json'])//this line
->post ('api / store', $ data);

Also, you can dump the response before asserting the status.

Oct
02
3 months ago
Activity icon

Replied to Test API Token Authorization:Bearer

Check this link https://laravel.com/docs/7.x/http-tests#customizing-request-headers

Example

$ response = $ this->withHeaders(['Authorization'=>'Bearer '.$token)->post ('api / store', $ data);
Activity icon

Awarded Best Reply on How To Click On Image Open The File Dialog

Embed the jquery with this

 window.addEventListener('load', function () {
        $(document).ready(function () {
	//put your script here
    });
})
Oct
01
3 months ago
Activity icon

Replied to How To Click On Image Open The File Dialog

Embed the jquery with this

 window.addEventListener('load', function () {
        $(document).ready(function () {
	//put your script here
    });
})
Activity icon

Replied to Check The Manual That C Orresponds To Your MariaDB Server Version For The Right Syntax To Use Near 'json Not Null

Please check the value of DB_CONNECTION in .env, seems like you are connecting to MariaDB instead of MySql

Activity icon

Replied to Carbon\Exceptions\InvalidFormatException Data Missing

Maybe due to invalid/null data passed into Carbon::parse()

Carbon::parse('Hi, I am the bug');
Sep
30
3 months ago
Activity icon

Awarded Best Reply on How To Show The Same Amount After Searching In Value?

Not quite, but I will try my best :)

Change the $request->name to $request->search instead?

Activity icon

Replied to How To Show The Same Amount After Searching In Value?

Not quite, but I will try my best :)

Change the $request->name to $request->search instead?

Sep
25
3 months 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 months 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 months 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
4 months 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