Questions tagged [laravel-controller]

218 questions
30
votes
9 answers

How to Verify Email Without Asking the User to Login to Laravel

I am developing a Laravel application. My application is using Laravel built-in auth feature. In the Laravel auth when a user registers, a verification email is sent. When a user verifies the email click on the link inside the email, the user has to…
Wai Yan Hein
  • 13,651
  • 35
  • 180
  • 372
10
votes
2 answers

Route to controller in Laravel 8

I'm working with Laravel 8 and when I write the route to the __invoke controller like this: use App\Http\Controllers\PortfolioController; Route::get('/portfolio', 'PortfolioController')->name('portfolio'); It shows this error: Invalid route…
Jota
  • 117
  • 1
  • 1
  • 7
4
votes
4 answers

Count data from database on laravel

On php i could use this code to get how many item on my goods db $total = 0; $sql = "select count(*) as total from goods"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $total =…
4
votes
3 answers

Return multiple values in laravel

I'm just new in laravel. I want to know. how to return multiple data/value. public function readItems() { $data1 = Data1::all (); $data = Data::all (); return $data; } I'm quite confuse how to do it. I don't to return it as a view, i…
chimichi004
  • 79
  • 2
  • 13
4
votes
0 answers

Multi auth API token laravel 5.4

I want to create Multi auth that have two parts (user and pemandu_bas). but when i tested POST 'pemandu_bas' token to postman, my 'pemandu_bas' is doesn't works as api. It keep show error like this .This is my config/auth.php 'guards' => [ …
4
votes
7 answers

Class App\Http\Controllers\StudentController does not exist in Laravel 5

I am building a module called Student in Laravel. I use the routes.php file inside the Student folder to write routes realted to student module.. When I use just Route::get('/list', function () { return view('welcome');}); program working fine…
3
votes
3 answers

Pluck and Implode Method in Laravel?

I have three classes Student, Session and student classes it has a relationship (Student with Enrollment, Session with Enrollment and student Class with enrollment), when I do echo it show the…
3
votes
1 answer

Call a Controller method from a Command in Laravel

I have a Command that is listening via Redis Pub/Sub. When a Publish is received, I want to call a controller method so that I can update the database. However, I have not been able to find any solution on how to call a controller method with…
MintMelt
  • 139
  • 1
  • 2
  • 12
2
votes
1 answer

Laravel 9 how to pass parameter in url from one controller to another controller?

I was facing this problem of missing parameter when trying to pass a parameter from one controller to another controller. The parameter is $id whereby the data is originally from post method in details blade.php into function postCreateStepOne…
2
votes
3 answers

Can not use controller name in laravel, must use namespace

Blade view and PostsController When I use {!! Forms::open(['method'=>'post', 'action'=>'PostsController@store']) !!} It errors out. But when I use {!! Forms::open(['method'=>'post', 'action'=>'App\Http\Contollers\PostsController@store']) !! It…
2
votes
2 answers

How to pass page title to views through controller in Laravel 8?

I'm trying to dynamically pass each page title to views via the controller. I have included the page header inside the views/components folder and passing it to each view as . Then in the header tag I'm trying to echo the page…
2
votes
0 answers

The command "backup:run" does not exist. while executing command using controller

I'm trying to back up the system using an HTTP request(using a button). I've configured my codebase according to the laravel spatie documentation. When I tried to run the command php artisan backup:run in the terminal it executes just fine and…
Avishka Dambawinna
  • 1,180
  • 1
  • 13
  • 29
2
votes
2 answers

Laravel Same Controller for Different User Types

I have two user types: Teacher and Student For students the route is: GET /me/books the students should only have their books in response. For teachers the route is: GET /books and teachers should have all the students' books in response. I have…
Egemenk
  • 307
  • 3
  • 9
2
votes
1 answer

Laravel 5.4: controller method is called twice on a redirect to it

I'm encountering a problem where a redirect from one route to another is calling the targeted controller method twice. This question addresses a similar issue, but the OP passing a 301 status code was deemed to be the issue in the accepted answer,…
Eli S
  • 63
  • 1
  • 6
2
votes
2 answers

laravel - ErrorException Array to string conversion

I'm trying to figure out how I can get the query result like $residence into the data array. because whem im doing this is gives me the error Array to string conversion. Is there any possible way to convert the query result to a normal string? /** …
Plance Development
  • 45
  • 1
  • 1
  • 13
1
2 3
14 15