Category : backend

this is route Route::post(‘/delete/comment/{comment}’, ‘[email protected]t’)->name(‘comment.delete’); this is function public function deleteAttachment(Comment $comment){ dd($comment); } and this is where I’m trying to use it <a target="_blank" class="btn btn-outline-danger function mr-2 " href="{{route(‘backend.ticket.comment.delete’,[‘comment’=>$comment->id])}}"><i class="mdi mdi-delete"></i></a> and this is error: The GET method is not supported for this route. Supported methods: POST. Sourc..

Read more

this is route Route::post(‘/delete/comment/{comment}’, ‘[email protected]’)->name(‘comment.delete’); this is function public function deleteAttachment(Comment $comment){ dd($comment); } and this is where I’m trying to use it <a target="_blank" class="btn btn-outline-danger function mr-2 " href="{{route(‘backend.ticket.comment.delete’,[‘comment’=>$comment->id])}}"><i class="mdi mdi-delete"></i></a> and this is error: The GET method is not supported for this route. Supported methods: POST. Sourc..

Read more

I founnd this topic: Target class controller does not exist – Laravel 8, so in web.php I wrote: use AppHttpControllersUserController; //… Route::get(‘/units’, [UnitsController::class, ‘getAllUnits’]); Route::get(‘/units2’, ‘[email protected]’); But any time I have this same error: Target class [UnitsController] does not exist. second address works but it’s so long and ugly. Why first address doesn;t work? Source: ..

Read more

this is where I need middlware public function getFileAttribute() { return route(‘backend.file_url’, [ ‘path’ => $this->attributes[‘attachment’], ]); } this is my route Route::get(‘file-url’, ‘[email protected]’)->name(‘file_url’); I want to use middlaware Like this but not in web.php or api.php I need it in controller Route::get(‘/download/{ticket}’, ‘[email protected]’)->name(‘download’)->middleware([‘can:download,ticket’]); Sourc..

Read more

I’m using Laravel and JWT token for develop backend APIs for frontend developers. I put status(active , inactive) column in database If user status is inactive then restrict him to using the app. part of login function which gives token on active user: if ($user->status == ‘active’) { return response()->json( [‘data’ => [‘token’ => $token, ..

Read more

So i have changed the default Auth table form user to Accounts like this in configauth.php : ‘defaults’ => [ ‘guard’ => ‘web’, ‘passwords’ => ‘accounts’, ], ‘guards’ => [ ‘web’ => [ ‘driver’ => ‘session’, ‘provider’ => ‘accounts’, ], ‘api’ => [ ‘driver’ => ‘token’, ‘provider’ => ‘accounts’, ‘hash’ => false, ], ], ‘providers’ ..

Read more

I need to remove the pagination and leave everything on one page, but this way I’m doing it only generates BUG. I wonder why the snippet of the commented code doesn’t work to remove the pagination. whereHas(‘sizes’, function($query) use($minParam, $maxParam) { if($minParam && $maxParam) { $query->whereBetween(‘max_capacity’, [$minParam, $maxParam]); } elseif($minParam) { $query->where(‘max_capacity’, ‘>=’, $minParam); } ..

Read more

I am upgrading maatwebsite/excel from v2.0 to v3.0. public function getValidatedRows($uploadedFile) { $validationRules = $this->getValidationRules(); $sheet = Excel::selectSheetsByIndex(0)->load($uploadedFile); $rows = $sheet->all(); if (!count($rows)) { throw new Exception(‘Invalid data.’); } $parsedRows = []; foreach ($rows as $key => $row) { $rowNumber = $key + 2; // Added + 2 since key is zero-indexed and first row ..

Read more

Im trying to test a job in laravel but with no success, when the job is called from a method inside a controller i get the following error: “Target [IlluminateContractsBusDispatcher] is not instantiable.” I already tried AltThree Bus command as an alternative. Controller method where thw job is called public function onOpen(ConnectionInterface $conn) { // ..

Read more

TypeError: Argument 1 passed to IlluminateDatabaseConnection::prepareBindings() must be of the type array, null given, called in C:xampphtdocsinventory-salesvendorlaravelframeworksrcIlluminateDatabaseConnection.php on line 672 in file C:xampphtdocsinventory-salesvendorlaravelframeworksrcIlluminateDatabaseConnection.php on line 593 this is my code $results = DB::select(`v.item_id`,`items.code`,`items.name`,`items.size`,`items.unit`,`v.unit_price`) ->addSelect(DB::raw(`min(case when seqnum_asc = 1 then v.end_balance end) as first_end_bal`)) ->addSelect(DB::raw(`min(case when seqnum_desc = 1 then v.end_balance end) as last_end_bal`)) ->selectSub(`min`, `unit_sold`) ..

Read more

I need to run factory using tinker but my model isn’t in app folder like this->AppModelsUser::factory()->count(2)->create(); the path is-> ModulesMenuEntitiesMenuPosition and when I run tis command php artisan tinker ModulesMenuEntitiesMenuPosition::factory()->count(2)->create(); there is error Class ‘Database/Factories/Modules/Menu/Entities/MenuPositionFactory’ not found in C:/laragon/www/menu–test/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/Factory.php on line 656 Sourc..

Read more

I’m try to create choose option with 500 users This my Controller … public function index() { $request = new IlluminateHttpRequest(); $employees = Employee::select(‘name’,’phone’,’email’,’id’, DB::raw(‘2020 – year(day_of_birth) as age’)); $amount = $request->record; dd($amount);// output is null if( $amount == ’25’) $employees= $employees->paginate(25); else if($amount == ’50’) $employees= $employees->paginate(50); else if($amount == ‘100’) $employees= $employees->paginate(100); else ..

Read more