Questions tagged [laravel-controller]
218 questions
0
votes
2 answers
Laravel limiting access to route
I am trying to implement a basic image fetch system for my website. Already created a route that returns me the image.
what concerns me is that i want that route to be only accessible by certain controllers.
Tried to search it and found out…

Skywarth
- 623
- 2
- 9
- 26
0
votes
2 answers
Use Custom Library in Controller of Laravel
I wanted to use nusoap_client class so decided to add nusoap library to my laravel project. Like other libraries, i used github readme page to get it done.
composer require econea/nusoap:^0.9.6
This library was added to…

Mehran Zamani
- 831
- 9
- 31
0
votes
2 answers
Custom Calculation in Laravel Controller
I am new to Laravel. I'm building a small app which displays the user table from the DB, but before sending it to the view, I want to include a custom value from another function.
The accounts table fetches the list of accounts from MySQL, and I…

user3001255
- 1
- 3
0
votes
1 answer
Refactor Repeated Controller Methods in Laravel
I'm a bit confused about my code in Laravel. I have a member that can subscribe to one or more lessons. I have three tables: members, lessons, and lesson_member.
I created a member form, and from this form, I can register the member in the lesson (I…

m.Sarto
- 179
- 3
- 16
0
votes
1 answer
Call to a Member Function fill() on Null Laravel
I've been trying to edit a record. My code will create a new record if the data is null. However, I get the following error:
Call to a member function fill() on null.
I'm not sure what I did wrong; maybe I didn't declare?
Controller

Adilah Abdullah
- 13
- 1
- 5
0
votes
2 answers
external classes and PHP files in Laravel - Class not found
I have two php files and I already created a folder called "ExternalClasses" and added the file to that folder. In my php file, I add this line:
namespace App\ExternalClasses;
and in my controller I add this line:
use…

Miss. Nada
- 321
- 1
- 4
- 14
0
votes
1 answer
Laravel list by month select option
I'm having issue with this. IT says "Too few arguments to function App\Http\Controllers\ViewsController::OBviews(), 0 passed and exactly 1 expected"
my controller:
public function OBviews($date)
{
$masterIds = DB::select('SELECT * FROM…

chimichi004
- 79
- 2
- 13
0
votes
0 answers
Nested Resource - Controller - Best Approach?
I am currently building an application where I have several Models that have the ability to 'have contacts' and wondered how to handle that in the best way in the controllers.
I have laid out some approaches below - which one do you guys think is…

SupaMonkey
- 876
- 2
- 9
- 25
0
votes
0 answers
Retrieving media upload in controller from array dynamically
I am using Laravel 5.1 and I am using Illuminate\Http\Request instance for accessing sent file requests, but I can't seem to find the correct way to access the media element. I can access all other values in the object.
Here is the JSON data format…

Tuomas Tuokkola
- 39
- 1
- 11
0
votes
1 answer
Same route on first link it works, but on second not. Laravel 5.6
Route file web.php:
Route::get('/download/received/{image_id}/{isoriginal?}', 'DownloadController@download_recv_image');
View:
Download…

Denis2310
- 939
- 1
- 15
- 41
0
votes
1 answer
Laravel: Routing & Controller
I'm a beginner using this laravel framework. Currently i'm trying to understand the routing and controller of this framework.
I created a controller file using this command:
php artisan make:controller Admin/PostController
Of course the output of…

Pablo
- 1,357
- 1
- 11
- 40
0
votes
2 answers
Laravel5.6 "Call to a member function delete() on null " , delete a row in table
I want to delete a row from table. The function I used in controller is:
public function destroy($id) {
$category = Category::find($id);
$category->delete();
return redirect()->back();
}
However it throws me an error:
Call to a member…

Ashar Khan
- 25
- 1
- 5
0
votes
1 answer
How to modify this Laravel route so that the media searches by id, but in the URL it shows slug?
Due to this below code URL looks like: /downloadpage/34
I want to make URL SEO-friendly like: /downloadpage/slug
In table 'media' there is a column slug. How to change in this code that media searches by id, but in URL it shows slug?
routes.php file…
0
votes
1 answer
Laravel 5: cookie set by custom Middleware not readable in Controller
I created a website with Laravel 5. In order to keep track of users that were referred to by some other website I use the following middleware that recognizes the referral by a request parameter and sets a cookie.

LaDude
- 1,383
- 1
- 11
- 27
0
votes
0 answers
Laravel 5.5 checkbox to switch blade layout with Ajax not working
I'm trying to have my laravel blade to switch layouts when a checkbox is selected/unselected, no visible result so far, What I am missing? Here's the relevant part of my code.
Blade index.blade.php
...
@if ($tab == true)

Diego
- 105
- 2
- 4
- 18