improve crude code for rahdaran
This commit is contained in:
@@ -14,18 +14,15 @@ use Illuminate\Http\Request;
|
||||
class RahdaranController extends Controller
|
||||
{
|
||||
use ApiResponse;
|
||||
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$allowedFilters = ['*'];
|
||||
$allowedSortings = ['*'];
|
||||
|
||||
$query = Rahdaran::query();
|
||||
$data = DataTableFacade::run(
|
||||
$query,
|
||||
return response()->json(DataTableFacade::run(
|
||||
Rahdaran::query(),
|
||||
$request,
|
||||
allowedFilters: $allowedFilters,
|
||||
allowedSortings: $allowedSortings);
|
||||
return response()->json($data);
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*'])
|
||||
);
|
||||
}
|
||||
|
||||
public function store(StoreRequest $request): JsonResponse
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Requests\V3\Rahdaran;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreRequest extends FormRequest
|
||||
@@ -11,13 +12,13 @@ class StoreRequest extends FormRequest
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Requests\V3\Rahdaran;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateRequest extends FormRequest
|
||||
@@ -11,13 +12,13 @@ class UpdateRequest extends FormRequest
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
|
||||
@@ -180,12 +180,12 @@ Route::prefix('rahdaran')
|
||||
->controller(RahdaranController::class)
|
||||
->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::post('/store', 'store')->name('store');
|
||||
Route::get('/{roadItemsProject}', 'show')->name('show');
|
||||
Route::post('/{roadItemsProject}', 'update')->name('update');
|
||||
Route::post('/delete/{roadItemsProject}', 'destroy')->name('destroy');
|
||||
Route::get('/list', 'list')->name('list');
|
||||
Route::get('/search', 'search')->name('search');
|
||||
Route::post('/', 'store')->name('store');
|
||||
Route::get('/{rahdaran}', 'show')->name('show');
|
||||
Route::post('/{rahdaran}', 'update')->name('update');
|
||||
Route::delete('/{rahdaran}', 'destroy')->name('destroy');
|
||||
});
|
||||
|
||||
Route::prefix('fms_vehicle')
|
||||
|
||||
Reference in New Issue
Block a user