Describe Fillable Attribute in a Laravel model

0 votes
Why Fillable Attribute is used in Laravel? Why it is used in composer in Laravel?

Thank You!!
Mar 27, 2020 in Laravel by kartik
• 37,520 points
41,311 views

2 answers to this question.

+1 vote

Hello @kartik

In eloquent ORM, $fillable attribute is an array containing all those fields of table which can be filled using mass-assignment.

Mass assignment refers to sending an array to the model to directly create a new record in Database.

Code Source

         class User extends Model {  

         protected $fillable = ['name', 'email', 'mobile'];   

         // All fields inside $fillable array can be mass-assigned  

         }  

Thank You!!

answered Mar 27, 2020 by Niroj
• 82,840 points
0 votes
protected $table = 'designations';

protected $fillable = [

'designation_name', 'designation_code','status'

];
answered Nov 11, 2020 by lintu

Related Questions In Laravel

0 votes
1 answer

How to mock a static facade methods in Laravel?

Hey, Facades provide a "static" interface to classes ...READ MORE

answered Mar 19, 2020 in Laravel by Niroj
• 82,840 points
6,537 views
0 votes
1 answer

How can we create a record in Laravel using eloquent?

We need to create a new model ...READ MORE

answered Mar 20, 2020 in Laravel by Niroj
• 82,840 points
1,211 views
0 votes
1 answer

.How to turn off CSRF protection for a particular route in Laravel?

Hey, We can add that particular URL or ...READ MORE

answered Mar 24, 2020 in Laravel by Niroj
• 82,840 points
4,213 views
0 votes
1 answer

How to make a constant and use globally in laravel?

Hii, You can create a constants.php page in config folder ...READ MORE

answered Mar 24, 2020 in Laravel by Niroj
• 82,840 points
4,063 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,012 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
2,994 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,918 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
44,688 views
0 votes
1 answer

Explain Guarded Attribute in a Laravel model?

Hii, The guarded attribute is the opposite of ...READ MORE

answered Mar 27, 2020 in Laravel by Niroj
• 82,840 points
34,961 views
0 votes
1 answer

What are the important directories used in a common Laravel application

Hey @Kartik. Directories used in a common Laravel ...READ MORE

answered Mar 17, 2020 in Laravel by Niroj
• 82,840 points
2,418 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP