Questions tagged [laravel-controller]

218 questions
0
votes
0 answers

How to prevent the file access from public in Laravel?

I still a newbie in Laravel. Please help me to solve my issue. I stuck on to prevent the file from the public. I trying to make the file access from public to private in Laravel 7. I put all of the links in the auth it made all of the links required…
0
votes
1 answer

how to save the array data into Laravel postgres?

How to store the following data into a database to ignore the null values too here is my database in postgres sql , where the UUID is project_id and array2 is indicators and array4 is the value column in the database.
ismail khan
  • 287
  • 1
  • 3
  • 16
0
votes
4 answers

Get the two different objects together

I've got $campus_groups coming from CampusGroup $campus_groups = CampusGroup::where('campus_id', $campus_id)->get(); which has [ …
0
votes
1 answer

Laravel: search and filter data

i want to multi filter data in laravel but i show this error: Too few arguments to function Illuminate\Support\Collection::get() Please help me to solve this issue. public function searchLanding(Request $request) { $landings =…
mehdij20
  • 3
  • 1
  • 3
0
votes
2 answers

How to refactor parameters in if-else condition coming from a request laravel?

I have this function in my controller that checks parameter requests and saves it into my table for tracking. However my if condition is quite too long because whenever a new request will be added I have to write individual if condition to each…
laurence keith albano
  • 1,409
  • 4
  • 27
  • 59
0
votes
1 answer

How to fill in missing dates from an array in laravel?

I have this function here that pulls data and group by created_at in my table. private function getSummaryData($seller) { $query = json_decode(json_encode(DB::select(DB::raw("select store_id, DATE_FORMAT(created_at, '%b %Y') ym, …
0
votes
1 answer

How to insert the missing months from an array in Laravel?

I have here a query that I have returns status for each months when I try to use dd($attr['month']) this will return an array of this but as what I've checked it seems that it has some missing months. private function getSummaryData($seller) { …
laurence keith albano
  • 1,409
  • 4
  • 27
  • 59
0
votes
1 answer

Make authorization Laravel

Im got error in section elseif, i want make HOD looking only at its own department data public function index(User $user) { if(auth()->user()->role == 'Admin') { $form = Form::all(); } …
0
votes
1 answer

How do i get data once in model and use the same data in multiple views passing through controller in laravel 8.x

For example, I want data from 3 models to MyModel4. $model1data = MyModel1::getList(); $model2data = MyModel2::getList(); $model3data = MyModel3::getList(); Purpose of getting these data is to prepare my create view, edit view and show view based…
0
votes
1 answer

Is it possible to use route parameter in route naming in laravel?

I am trying invokable controller in Laravel : php artisan make:controller ProvisionServer --invokable And I want to do something like : Route::get('/proviser/{page}',[App\Http\Controllers\ProvisionServer::class, '__invoke']) …
Cutis
  • 949
  • 1
  • 13
  • 32
0
votes
1 answer

How to call controller method with array

Controller import() Import data from csv file and redirect with array of data //import data from csv file return redirect('school/student/import')->with('result', $result); import.blade.php This is a modal form and imported data is shown to user. …
devnc
  • 70
  • 7
0
votes
1 answer

Add pagination to load () or any solution Laravel 8

Please how i can add paginate to my show method ? I have connect models and i need to have select by region and pagination. public function show(Tournament $tournament) { $tournament->load('region'); return…
0
votes
2 answers

Two route variables with the same start URL in Laravel 8

Is possible have two variables and same start of URL?I mean 'turnaje/{tournament}' and 'turnaje/{region}'. Route::get('/turnaje', [TournamentController::class, 'index']); Route::get('/turnaje/pridat', [TournamentController::class, 'create']) …
Tom_hutka
  • 15
  • 4
0
votes
1 answer

I change routes on resources and my tournaments pages are empty. LARAVEL 8

Hi a used every controller method as one after i created store method so i change it on Route::resource, i wanted translate routes names so i used AppService provider and add Slovakian language to routes but now i have problem and my routes are good…
0
votes
1 answer

Redirect to saving post after the send to DB LARAVEL 8

how i have to write redirect rout for redirect after save tournament to my new tournament site. Thanks This doesnt work return redirect()->route('tournaments.show', $tournament->slug); Controller public function store(Request $request) { …