Downloads
Stars
Version
Use the
php artisan vendor:publish
command to publish the NetworkController
configuration.
EmployeeController
, with the \api\employee
endpoint, add the following entry in
the api.php
in the \routes
folder: Route::resource('employee', EmployeeController::class);
\App\Http\Models\
folder\App\Http\Models\
folderAdd the following code in the api.php
in the \routes
folder:
use Nevestul4o\NetworkController\Controllers\ImagesController;
use Nevestul4o\NetworkController\Controllers\UploadController;
Route::get('images/{width}/{name}', [ImagesController::class, 'getImage'])->name('get-image');
Route::post('upload', [UploadController::class, 'uploadSubmit']);
Add the following configuration to the .env
file:
UPLOADS_PATH=../uploads/files
IMAGES_PATH=../uploads/images
IMAGES_RESIZED_PATH=../cache/images
IMAGES_SUPPORTED_SIZES=300,600,900
IMAGES_REMOVE_METADATA=TRUE
There is a command that allows to remove all resized images:
php artisan network-controller:images-clear-cache
\App\Http\Models\
folder, extending BaseUser
auth.php
to \App\Http\Models\User
App\Http\Models\Transformers\
folderapi.php
: use Nevestul4o\NetworkController\Controllers\Auth\LoginController;
use Nevestul4o\NetworkController\Controllers\Auth\ChangePasswordController;
Route::post('login', [LoginController::class, 'login'])->name('login');
Route::get('login', [LoginController::class, 'login'])->name('getCurrentUser');
Route::post('logout', [LoginController::class, 'logout'])->name('logout');
Route::post('change-password', [ChangePasswordController::class, 'changePassword'])->name('changePassword');
Route::post('change-password-forced', [ChangePasswordController::class, 'changePasswordForced'])->name('changePasswordForced');
changePasswordForced
in ChangePasswordController is NOT secured!
It can change the password of the user, without his current password.
Take care te secure it manually, when defining the API route, or override it!