Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel fillable

    /**
     * The attributes that are mass assignable.
     */
    protected $fillable = [
      					   'title',
                           'slug',
                           'body',
                           'image',
                           'published',
                           'comments_open'
                          ];
Comment

laravel get fillable attributes

$model = new Demo();
dd($model->getFillable());
Comment

fillable in laravel

//for comment Section

//commentController.php
    public function store(StoreCommentRequest $request)
    {
        //
        $comment = Comment::create([
            "message"=>$request->message,
            "post_id"=>$request->post_id,
            "user_id"=>Auth::id(),
        ]);
        return redirect()->to(url()->previous()."#comment-create");    
    }

//Comment.php <= model

    class Comment extends Model
    {
    use HasFactory;

    protected $fillable =["message","user_id","post_id"];
    }

Comment

PREVIOUS NEXT
Code Example
Php :: php if elseif endif 
Php :: Laravel migrations custom foreign key 
Php :: laravel trim string blade 
Php :: php laravel dump 
Php :: php get all array keys in json 
Php :: leftJoinSub laravel 
Php :: laravel list of models 
Php :: seprate day and year from laravel to timestamp 
Php :: IlluminateContractsAuthAuthenticatable, AppModelsUser given, called in 
Php :: do artisan laravel in code 
Php :: codeigniter how to know update failed 
Php :: get file request in laravel 
Php :: laravel create session table 
Php :: laravel reload relationship 
Php :: tinker faker 
Php :: how to get the root domain in laravel 
Php :: laravel model::query 
Php :: get git branch by php 
Php :: laravel login shows 404 
Php :: Method IlluminateSupportCollection::links does not exist. 
Php :: vs code php tag shortcut 
Php :: call api php 
Php :: return message in laravel 
Php :: php pdo 
Php :: how to create constant in php 
Php :: how to search like in php 
Php :: laravel model factory attribute 
Php :: spaceship operator 
Php :: how to declare global variable in laravel controller 
Php :: set cookie on button click JavaScript 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =