🚚 Renomme le controlleur principal

This commit is contained in:
Clement Desmidt 2020-03-12 17:31:13 +01:00
parent 6f5f362bf9
commit 020eec2a60
2 changed files with 8 additions and 10 deletions

View File

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Post;
use App\PostsTag;
use App\Services\ImageService;
use App\Services\TagDetectorService;
use App\Tag;
use DateTime;
@ -13,7 +14,7 @@ use Illuminate\Support\Facades\Redirect;
use Intervention\Image\Constraint;
use Intervention\Image\Facades\Image;
class HomeController extends Controller
class DashboardController extends Controller
{
/**
* Create a new controller instance.
@ -127,7 +128,7 @@ class HomeController extends Controller
* @return mixed
* @throws \Exception
*/
public function store(TagDetectorService $tag_detector)
public function store(TagDetectorService $tag_detector, ImageService $image_service)
{
$user_id = Auth::user()->getAuthIdentifier();
@ -147,10 +148,7 @@ class HomeController extends Controller
$uploaded_document = $validated_data['file'];
$file_name = $uploaded_document->getClientOriginalName();
$uploaded_document->storeAs(Auth::user()->getFolder(), $file_name);
$img = Image::make($uploaded_document->getRealPath());
$img->resize(300, null, static function (Constraint $constraint) {
$constraint->aspectRatio();
})->save(sprintf('%s/%s/%s', storage_path('app'), Auth::user()->getFolder(), sprintf('300-%s', $file_name)));
$image_service->makeThumbnail($uploaded_document->getRealPath(), ['width' => 300]);
$data['image'] = $file_name;
}

View File

@ -14,10 +14,10 @@
Auth::routes();
Route::get('/', 'WelcomeController@index')->name('home');
Route::get('/home', 'HomeController@index')->name('dashboard');
Route::post('store', 'HomeController@store')->name('store');
Route::post('delete', 'HomeController@delete')->name('delete');
Route::post('edit', 'HomeController@edit')->name('edit');
Route::get('/home', 'DashboardController@index')->name('dashboard');
Route::post('store', 'DashboardController@store')->name('store');
Route::post('delete', 'DashboardController@delete')->name('delete');
Route::post('edit', 'DashboardController@edit')->name('edit');
Route::post('stats', 'StatsController@tag')->name('stats'); // TODO make a group for stats
Route::get('/display/{post_id}/{options}/{image_name}', 'ImageController@display')->name('display_image');
Route::get('/gallery', 'ImageController@gallery')->name('gallery');