Skip to content

Commit

Permalink
Use controller vs closure so route is cacheable. Closes #24 (#26)
Browse files Browse the repository at this point in the history
* Use controller vs closure so route is cacheable. Closes #24

* Apply fixes from StyleCI (#25)
  • Loading branch information
edgrosvenor authored May 1, 2020
1 parent 999037a commit 07110a5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
15 changes: 15 additions & 0 deletions src/ForgetSheet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Grosv\EloquentSheets;

use Illuminate\Support\Facades\File;

class ForgetSheet
{
public function execute($id)
{
File::delete(config('sushi.cache-path').'/'.$id.'.sqlite');

return response()->noContent();
}
}
9 changes: 2 additions & 7 deletions src/routes.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<?php

use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Request;
use Grosv\EloquentSheets\ForgetSheet;
use Illuminate\Support\Facades\Route;

Route::get('/eloquent_sheets_forget/{id?}', function (Request $request, $id) {
File::delete(config('sushi.cache-path').'/'.$id.'.sqlite');

return response()->noContent();
});
Route::get('/eloquent_sheets_forget/{id?}', [ForgetSheet::class, 'execute']);

0 comments on commit 07110a5

Please sign in to comment.