Questions tagged [laravel-controller]
218 questions
0
votes
1 answer
How to make an API endpoint in Laravel, that can be used to search any table we want?
Background
Let us consider a hypothetical scenario. Suppose we have five different tables in our database,
Customers
Categories
Products
Orders
OderDetails
Our client wants us to add a search bar to the frontend, where a user can search for a…

gfit21x
- 141
- 9
0
votes
2 answers
Laravel 8 dropdown list pull from data and filter to the Data-table
Laravel 8 with User & teamwork together
I am working on data-table javascript, and controller but the error is still there, and it bugged me as I am not knowledgeable with laravel as I only work on laravel for one month (it's perfect code and way…

Steven Fleet
- 27
- 1
- 7
0
votes
1 answer
ArgumentCountError on Laravel 8
I'm using laravel 8 and when i write route like this:
web.php
Route::match(['get', 'post'], '/', [PageController::class, 'index']);
Route::match(['get', 'post'], '/tshirt', [PageController::class, 'productCategory']);
Route::match(['get', 'post'],…

Tara Ivaldi
- 3
- 2
0
votes
1 answer
return redirect()->route with request not parameter in laravel?
I have a function with the name of Direction which takes the request and redirects to the following view if the condition is true. here is the code
public function direction(Request $request)
{
$activity_id=$request->id;
…

ismail khan
- 287
- 1
- 3
- 16
0
votes
1 answer
how to implement Single Responsibility in laravel
I am so confused about how to implement and how to follow SRP (single responsibility principle ) in a Laravel controller.
Suppose we have a controller which we have to do these things:
e.g
public function StorePost() {
// check user…

Abbas
- 117
- 10
0
votes
1 answer
How do I populate a table column based on the month input of 'login_at' column in an existing database in Laravel
I have an existing database which is already populated. I created a new column to store the month in which the data was populated.
How do I populate the 'month' column with data based on the login_at at column of each row?
I am able to populate the…

Al4321
- 89
- 11
0
votes
4 answers
Laravel - How to pass parameter from controller to route and use it in another controller?
I have configured a resource route as below
Route::resource('users', UserController::class);
When a user posts data, it will call the store method in the controller where it will add the data and set a message for success/failure.
public function…

Vishnu Priyan
- 3
- 4
0
votes
1 answer
how to convert the following query into Eloquent?
I have a query that work fine but does not work pagination how to convert into eloquent to apply pagination
$projects=DB::select("select * from projects INNER JOIN(select DISTINCT * from (SELECT project_id FROM district_group_project_users where…

ismail khan
- 287
- 1
- 3
- 16
0
votes
1 answer
Laravel 6 Follow-Unfollow system sql problem
I'm new to Laravel and I am trying to do a follow-unfollow system. I have tried to figure it out by myself for a week but I haven't found any solution. I think I am doing wrong the SQL statement in the controller. This is the code in…

Arian Kapllanaj
- 31
- 2
- 8
0
votes
1 answer
Laravel Controller does not exist, but actually it does
I have some problem with the controller. In my local repo as I serve the project it works!
route: at web.php Route::get('/jobs', 'one\jobs\JobsController@index'); But as I tried at my company's server it didn't work! It says controller does not…

Ivan Yunus Kolotosa
- 27
- 5
0
votes
2 answers
Laravel 6 how to store logged user's id in controller
I am trying to store logged user's id but I am getting this error
ErrorException
array_map(): Argument #2 should be an array
This is the code in the controller
public function store(Request $request)
{
if (!auth()->check()) {
…

Kostandin Vllahu
- 231
- 7
- 16
0
votes
1 answer
Laravel 6 Undefined variable: jobs
I think there is no error but Laravel shows the following error:
Undefined variable: jobs
public function jobCreate(Request $request){
$data['jobs'] = DB::table('jobs')->get();
$job_category = JobCategory::all();
// $job_locations =…

Mehedi Hasan
- 1
- 1
0
votes
1 answer
How to update an image Summernote in Laravel7?
I have a problem when updating more images on share hosting but in my local machine everything is fine
I got this error from my shared hosting.
file_put_contents(/public/storage/article_image/post_162069532710.png): failed to open stream: No such…

Jill
- 49
- 6
0
votes
1 answer
Invalid argument supplied for foreach() vue js in laravel
I cannot upload multiple images in my Laravel + vue js project..
here is my code below
my vue conponent
0
votes
3 answers
How to show bank balance through transactions in laravel
I have Bank table and transaction table. The relationship is one-to-many, so a bank may have many transactions. Transaction table has the bank foreign key(bank_id). and each transaction has a column 'type' which is either credit or debit.
I want to…

Mahdi Jafari
- 347
- 6
- 22