saeed410

Member Since 3 Months Ago

Experience Points
4,070
Total
Experience

930 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
26
Lessons
Completed
Best Reply Awards
2
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 1
4,070 XP
Jan
16
1 week ago
Activity icon

Replied to QR Code Generator

use this package : simplesoftwareio/simple-qrcode and save image :

$fileNameCodeUnique = md5(time()); $qrcode = QrCode::size(512) ->format('svg') ->generate($request->code, base_path() . '/storage/app/public/qrproducts/qrcodes/' . $fileNameCodeUnique . '.svg');

Oct
24
3 months ago
Activity icon

Awarded Best Reply on Blade Formatter For Visual Studio Code.

I have already done all the answers to that post except one that needs modification for beautify. I did it now but it did not work for version 1.5. I solve my problem by using this gist : https://gist.github.com/maliouris/f84b7f3dcb2a71455e693716e76ce302

it's not perfect But there is no choice.

Activity icon

Replied to Blade Formatter For Visual Studio Code.

I have already done all the answers to that post except one that needs modification for beautify. I did it now but it did not work for version 1.5. I solve my problem by using this gist : https://gist.github.com/maliouris/f84b7f3dcb2a71455e693716e76ce302

it's not perfect But there is no choice.

Activity icon

Started a new Conversation Blade Formatter For Visual Studio Code.

recently I tried all formatters in the market place. But none of them work well. Please Introduce me a trusted formatter if you know.I'm exhausted :-(

Oct
12
3 months ago
Activity icon

Replied to How To Notify Comment Owner And Not Auth User

did you add $fillable=[]; fields in your models?

Oct
05
3 months ago
Activity icon

Replied to How To Update BelonsToMany (value)

well, i use $user->socials()->sync($socials); after saving user(when editing or creating).

Activity icon

Replied to Dynamically Retrieve A Model Based On It's Name And Id.

but you can add polymorphic relations to Models and used them with Eloquent. https://laravel.com/docs/8.x/eloquent-relationships#polymorphic-relationships

I use it for commenting posts, news, profiles, user walls. also, I use it for attachments for many models. you only need an additional two extra columns to table comments (one for model id and one for model type(Model class name)). and Eloquent automatically Recognizes Relevant models.

note: When you want to add a polymorphic type, add the full model address. This is not mentioned in the Laravel Document(ex: 'App\Models\Project').

Activity icon

Replied to How To Update BelonsToMany (value)

Sorry. Explain to me exactly what the value column is for? your definitions are wrong. drop the value column.and add bellow relations to your Models. in User.php :

public function socials() { return $this->belongsToMany(Social::class); }

in Social.php :

public function users() { return $this->belongsToMany(User::class); }

if you have timestamps in pivot table add ->withTimestamps() chain to belongsToMany.

Activity icon

Replied to How To Set Locale In Laravel Work With Moment.js?

read momentJS documentation.if you are using webpack with mixer You must write code to contain it. another simple way is Add it(CDN or file) to the blade layer with script tag.

Activity icon

Replied to How To Get Data From Relationship Table

do you add relations function to all Models that i wrote before? this is an array of details : Auth::User()->voucherdetails()->get(); you have three tables.first you must specify relations types.one-to-one or one-to-many. Then I can help you better.

Activity icon

Awarded Best Reply on How To Get Data From Relationship Table

1 - add foreign keys to your tables :

for companyregisters :

$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');

for voucherdetails:

$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('company_id')->references('id')->on('companyregisters')->onDelete('cascade')->onUpdate('cascade');

2 - change column type for user_id :

$table->unsignedBigInteger('user_id');

also look at your database if companyregisters table id and voucherdetails table id are big int(20) change theme too. 3 -php artisan migrate

4 - add Model Relationships : for User Model :

public function companyRegisters(){ return $this->hasMany(CompanyRegister::class); } public function voucherDetails(){ return $this->hasMany(VoucherDetail::class); }

for CompanyRegister Model :

public function user(){ return $this->belongsTo(User::class); } public function voucherDetails(){ return $this->hasMany(VoucherDetail::class); }

for VoucherDetail class :

public function user(){ return $this->belongsTo(User::class); } public function companyRegister(){ return $this->belongsTo(CompanyRegister::class); }

done.now you can access relations in controllers :

for User Model Objects: $companies=Auth::User()->companyRegisters()->get(); $voucherDetails=Auth::User()->voucherDetails()->get();

for CompanyRegister Model Objects: $user=$company->user; voucherDetails=$company->voucherDetails()->get();

for VoucherDetail Model Objects: $user=$VoucherDetail ->user; $company==$VoucherDetail ->companyRegister;

Activity icon

Replied to How To Get Data From Relationship Table

$id=Auth::id(); or $id=Auth::user()->id();

I assumed the relationship between the user and company is one-to-many. based on your tables: a user has many companies and a company belongs to one user. if you want to get Logged-in user companies Use the following code:

Auth::User()->companyRegisters()->get();

get all companies associated with the user.

*if your relation between user and company is one-to-one you must change companyRegisters() function in User Model Like the code below:

public function companyRegister(){ return $this->hasOne(CompanyRegister::class); }

then you can get user company by using code below :

$loggedInUserCompany=Auth::User()->companyRegister;

Activity icon

Replied to Strange Certification Question

only 4 is correct.also if option 3 was $user->purchase_date= new Carbon("2020-10-10 10:10:10"); It could be right. remember there is no such purchaseDate attribute in user model. it's just purchase_date. that's right 4 pass strings to attribute but set attribute triggered and convert string to Carbon.

Oct
04
3 months ago
Activity icon

Replied to How To Get Data From Relationship Table

1 - add foreign keys to your tables :

for companyregisters :

$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');

for voucherdetails:

$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade'); $table->foreign('company_id')->references('id')->on('companyregisters')->onDelete('cascade')->onUpdate('cascade');

2 - change column type for user_id :

$table->unsignedBigInteger('user_id');

also look at your database if companyregisters table id and voucherdetails table id are big int(20) change theme too. 3 -php artisan migrate

4 - add Model Relationships : for User Model :

public function companyRegisters(){ return $this->hasMany(CompanyRegister::class); } public function voucherDetails(){ return $this->hasMany(VoucherDetail::class); }

for CompanyRegister Model :

public function user(){ return $this->belongsTo(User::class); } public function voucherDetails(){ return $this->hasMany(VoucherDetail::class); }

for VoucherDetail class :

public function user(){ return $this->belongsTo(User::class); } public function companyRegister(){ return $this->belongsTo(CompanyRegister::class); }

done.now you can access relations in controllers :

for User Model Objects: $companies=Auth::User()->companyRegisters()->get(); $voucherDetails=Auth::User()->voucherDetails()->get();

for CompanyRegister Model Objects: $user=$company->user; voucherDetails=$company->voucherDetails()->get();

for VoucherDetail Model Objects: $user=$VoucherDetail ->user; $company==$VoucherDetail ->companyRegister;