# File Storage

  1. Create migrations to alter trainings table

  2. Add attachment input in views

  3. Create Symbolic Link

  4. Check in Controller if the input has attachment and update row with the file name.

  5. Delete the file on storage if the row will be deleted

  6. Open attachment file

# 1. Create migrations to alter table

php artisan make:migration alter_articles_table_add_attachment

Storage

# 2. Add attachment input in views

Storage

create.blade.php

The public disk is intended for files that are going to be publicly accessible. By default, the public disk uses the local driver and stores these files in storage/app/public. To make them accessible from the web, you should create a symbolic link from public/storage to storage/app/public.

To create the symbolic link, you may use the storage:link Artisan command:

php artisan storage:link

# 4. Check Controller

Check in Controller if the input has attachment and update row with the file name.

In Model, update fillable with attachment to allow mass assignment method.

Storage

# 5. Delete

Delete the file on storage if the row will be deleted

Storage

TrainingController.php on delete method

# 6. Open Attachment

Storage

show.blade.php