Soft deletes task

This commit is contained in:
PovilasKorop
2021-11-16 10:45:45 +02:00
parent a5acfdd85f
commit 328e51c4ee
7 changed files with 45 additions and 1 deletions
@@ -28,4 +28,14 @@ class ProjectController extends Controller
return redirect('/')->with('success', 'Projects updated');
}
public function destroy($projectId)
{
Project::destroy($projectId);
// TASK: change this Eloquent statement to include the soft-deletes records
$projects = Project::all();
return view('projects.index', compact('projects'));
}
}
+2 -1
View File
@@ -4,8 +4,9 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Project extends Model
{
use HasFactory;
use HasFactory, SoftDeletes;
}