Questions tagged [laravel-controller]
218 questions
2
votes
1 answer
Class 'app\login' not found in laravel 5.8
I am using laravel 5.8 and have an issue with model class. Since model is placed directly in app folder.
namespace App;
use Illuminate\Database\Eloquent\Model;
class Login extends Model
{
//
}
In Controller, I am using
namespace…

Sajjad Ali
- 156
- 9
2
votes
3 answers
Laravel can I add two update method on a resource controller
I'm new to laravel and I would like to add another Update method from the created resource controller UsersController.
something like this:
public function update(Request $request, $id)
{
"logic here"
}
public function update2(Request…

Evan
- 2,327
- 5
- 31
- 63
2
votes
2 answers
Laravel 5.6 strange behavior - Laravel doesn't see a controller after I rename it
I have a controller named RankController.php. I rename in UsersController.php manually when I want to separate some methods. Then I choose to rename it back in to RankController.php. Note: I only change the name of the file, I don't change the name…

Triumfatorul32
- 37
- 6
2
votes
2 answers
Laravel Controller : How to use function store and create
I am currently new to laravel and I am working on a basic project where a service provider (SP) is able to post service details by filling up a form.
I am trying to check if SP has uploaded a featured image. If yes, then rename file by using…

mkirr
- 81
- 2
- 5
- 15
1
vote
1 answer
The array will send only the first element to the database , how to send the array of 3 elements in Laravel-8 controller through API?
$client = new Client([
'base_uri' => 'http://localhost',
]);
$response = $client->request('POST', '/API/customerOrder/createOrder.php', [
'json' =>[
'SKU_QUANTITY' => [9,7,8],// we send the array of 3 elements to specific ID…

Soumen
- 9
- 2
1
vote
1 answer
how to display a svg image in a blade.php file in laravel controller
I'm having my logo in resources/layouts/inc/logo.blade.php in svg format
Now I wanna display the logo in a pdf that I've created using dompdf in a Controller
in my PdfController.php
$output = '
…

Sam Leumas
- 23
- 5
1
vote
1 answer
2 foreign keys referencing same primary key laraavel
I'm relatively new in Laravel and I would like to learn how to create recursive relation with 2 foreign keys referencing the primary key.
I have table item_associations which has 2 FK referenced to the item table's…

Amir Adamov
- 43
- 3
1
vote
0 answers
Passing json from db to blade template
Let say I have ["gravy1", "gravy2"] in table's column "gravy". How can I display it so I can get this result:
This is my controller:
$grav = DB::table('items')
->select('gravy')
->get();
$gravies = json_decode($grav);
return view('welcome', [
…

Amir Adamov
- 43
- 3
1
vote
1 answer
Even though the correct id is set in the href of the anchor tag, my controller takes an id one behind
What I have
blade.php file

gfit21x
- 141
- 9
1
vote
2 answers
Method SendMoneyController::index does not exist
I am using Laravel 8, and my application is working fine locally. Now I upload the app to a dedicated server and I'm getting the error below:
BadMethodCallException Method
App\Http\Controllers\User\SendMoneyController::index does not…

Irshad Khan
- 55
- 6
1
vote
1 answer
How do I limit a database field update to once in 24hrs per user in Laravel
I have created an API that records records on the LoginActivity table anytime a user logs in. I want to the recorded activity to be only recorded once in 24hrs for every user.
This is my activity_record.py model

Al4321
- 89
- 11
1
vote
0 answers
Laravel simple request is toooooo slow
I have a problem: When trying to get a single user from the database using laravel controller response is just too slow. Response time is over 1000ms, see Postman screenshot below.
Below is my code:
Controller:
public function getUserData(Request…

Mirko Druzijanic
- 13
- 1
- 8
1
vote
1 answer
How to fixed 419 unknown status in XMLHttpRequest?
I have an error in my XMLHttpRequest() when sending a post request to my url. When I check my console.log it says
this line of code:
xhr.send();
Error: Failed to load resource: the server responded with a status of 419 (unknown status)
Here's my…

laurence keith albano
- 1,409
- 4
- 27
- 59
1
vote
2 answers
Structuring Laravel Controllers
I have
users
id
username
companies
id
areas
id
area_company
id
area_id
company_id
area_company_user
id
area_company_id
user_id
company_user
id
company_id
user_id
area_user
id
…

Tiago Martins Peres
- 14,289
- 18
- 86
- 145
1
vote
2 answers
Update data of model relationships when using foreach loop
I am a newbie in Laravel, and I'm trying to use a foreach loop with updateOrCreate() in the update function. However, it doesn't work, and there is no error. I have the following three models.
Sales Team
class SalesTeam extends Model
{
public…

Jill
- 49
- 6