Description
We will continue previous Laravel 8 - CRUD basic steps (Livewire and Tailwind) tutorial. But this ti... Tagged with laravel, livewire, crud, tailwind.
Summary
- Let's add more fields in companies table.
- We want to add extra fields for information about which user created or updated company.
- phpnamespaceApp\Models;useIlluminate\Database\Eloquent\Factories\HasFactory;useIlluminate\Database\Eloquent\Model;useIlluminate\Support\Facades\Auth;classCompanyextendsModel{useHasFactory;protected$fillable=['title','created_by','updated_by'];/** * This is model Observer which helps to do the same actions automatically when you creating or updating models * * @var array */protectedstaticfunctionboot(){parent::boot();static::creating(function($model){$model->created_by=Auth::id();$model->updated_by=Auth::id();});static::updating(function($model){$model->updated_by=Auth::id();});}} If we are thinking to use this modal in other places, need to create standard modal style (frame), which we can use with different content.