🚚 Renomme le controlleur principal
This commit is contained in:
parent
6f5f362bf9
commit
020eec2a60
@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Post;
|
use App\Post;
|
||||||
use App\PostsTag;
|
use App\PostsTag;
|
||||||
|
use App\Services\ImageService;
|
||||||
use App\Services\TagDetectorService;
|
use App\Services\TagDetectorService;
|
||||||
use App\Tag;
|
use App\Tag;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
@ -13,7 +14,7 @@ use Illuminate\Support\Facades\Redirect;
|
|||||||
use Intervention\Image\Constraint;
|
use Intervention\Image\Constraint;
|
||||||
use Intervention\Image\Facades\Image;
|
use Intervention\Image\Facades\Image;
|
||||||
|
|
||||||
class HomeController extends Controller
|
class DashboardController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new controller instance.
|
* Create a new controller instance.
|
||||||
@ -127,7 +128,7 @@ class HomeController extends Controller
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function store(TagDetectorService $tag_detector)
|
public function store(TagDetectorService $tag_detector, ImageService $image_service)
|
||||||
{
|
{
|
||||||
$user_id = Auth::user()->getAuthIdentifier();
|
$user_id = Auth::user()->getAuthIdentifier();
|
||||||
|
|
||||||
@ -147,10 +148,7 @@ class HomeController extends Controller
|
|||||||
$uploaded_document = $validated_data['file'];
|
$uploaded_document = $validated_data['file'];
|
||||||
$file_name = $uploaded_document->getClientOriginalName();
|
$file_name = $uploaded_document->getClientOriginalName();
|
||||||
$uploaded_document->storeAs(Auth::user()->getFolder(), $file_name);
|
$uploaded_document->storeAs(Auth::user()->getFolder(), $file_name);
|
||||||
$img = Image::make($uploaded_document->getRealPath());
|
$image_service->makeThumbnail($uploaded_document->getRealPath(), ['width' => 300]);
|
||||||
$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)));
|
|
||||||
$data['image'] = $file_name;
|
$data['image'] = $file_name;
|
||||||
}
|
}
|
||||||
|
|
@ -14,10 +14,10 @@
|
|||||||
Auth::routes();
|
Auth::routes();
|
||||||
|
|
||||||
Route::get('/', 'WelcomeController@index')->name('home');
|
Route::get('/', 'WelcomeController@index')->name('home');
|
||||||
Route::get('/home', 'HomeController@index')->name('dashboard');
|
Route::get('/home', 'DashboardController@index')->name('dashboard');
|
||||||
Route::post('store', 'HomeController@store')->name('store');
|
Route::post('store', 'DashboardController@store')->name('store');
|
||||||
Route::post('delete', 'HomeController@delete')->name('delete');
|
Route::post('delete', 'DashboardController@delete')->name('delete');
|
||||||
Route::post('edit', 'HomeController@edit')->name('edit');
|
Route::post('edit', 'DashboardController@edit')->name('edit');
|
||||||
Route::post('stats', 'StatsController@tag')->name('stats'); // TODO make a group for stats
|
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('/display/{post_id}/{options}/{image_name}', 'ImageController@display')->name('display_image');
|
||||||
Route::get('/gallery', 'ImageController@gallery')->name('gallery');
|
Route::get('/gallery', 'ImageController@gallery')->name('gallery');
|
||||||
|
Loading…
Reference in New Issue
Block a user