1,832 questions
0
votes
0
answers
47
views
Laravel web route protection
In my laravel v5.8.38 want to protect some routes based on user roles. A user can have multiple roles like this:
{
"role": "hospitaladmin",
"user": {
&...
0
votes
1
answer
56
views
how to store form with 1500 plus fields using jquey ajax in laravel
How can I store a form with more than 1500 fields in Laravel 5.8?
Controller:
public function store(Request $request)
{
dd($request->all());
}
View file:
@extends('main')
@section('content')
...
-2
votes
1
answer
226
views
How to solve versions problem in laravel? [closed]
I have an old Laravel project with version 5.8, and I've downloaded PHP with version 7.1.33, but these errors continue to appear
I can't do anything with these errors!
I've tried to create a new ...
0
votes
0
answers
90
views
laravel 5.8 verification email contains ID how to obfuscated it and verify it after click
I have a project that is made using Laravel 5.8.
I'm so surprised that Laravel verification link contains the raw id of the user given that this framework have a great decent amount of security !
Can ...
0
votes
2
answers
76
views
Laravel belongsToMany select all specified ids
Relation
public function groups()
{
return $this->belongsToMany('App\Models\ItemGroup','item_to_group','item_id','item_group_id');
}
**
How to select all Items that have ...
0
votes
2
answers
869
views
How I can hide some parameters from request body once an error is reported into sentry?
In a laravel php application I use the sentry to keep error info for example this controller:
class MuController
{
private function someMethodThatThrowsException()
{
throw new \Exception('Told ...
0
votes
1
answer
2k
views
Why doesn't composer recognize psr/simple-cache/src
enter image description here
I have to use composer version 1 in the Laravel Project (5.8 version). If I run the composer install command,
In InstalledVersions.php line 159:
Package psr/simple-cache ...
-1
votes
1
answer
70
views
How to make a field required if it appearing on a form
I have a Laravel 5.8 project and on a Blade I added this:
@if(empty($user->usr_name))
<div class="row">
<div class="col-md-12">
<div ...
0
votes
2
answers
108
views
How to add if..else conditional statements to the db query builder of Laravel
I have a export method in Laravel 5.8 for exporting some results from oders table:
public static function getAllData()
{
$records = DB::table('orders as t1')
->leftjoin('...
1
vote
2
answers
56
views
How to make two columns of a table requiring to be unique at user request
I have tried validating the user request like this:
$data = $request->validate([
'fname' => 'nullable',
'lname' => 'nullable',
'gender' => 'required',
'mobile' => '...
1
vote
1
answer
56
views
LaravelExcel Maatwebsite does not export data
I'm working with Laravel 5.8 and I have added LaravelExcel Maatwebsite to export some data from the DB into Excel file.
So I tried adding this method to the Model:
public static function getAllData()
{...
1
vote
4
answers
288
views
How to subtract two columns from each other when using case expression
I want to export some results in Excel from the Model method, so I added this,
public static function getAllData()
{
$records = DB::table('orders as t1')
->leftjoin('payments as t2',...
0
votes
2
answers
49
views
How to add LIKE to this Eloquent query
I'm working with Laravel 5.8 and I have this method:
public function getCourseDefinition()
{
$course_definition = DB::table('getCourseDefinition');
if (request()->has('...
1
vote
1
answer
26
views
Retrieving data based on One To Many Relationship
I have two tabled called categories and resources table.
Basically each resource has a category and the category id is saved on a column called resource_category_id in resources table.
So in order to ...
1
vote
1
answer
386
views
How to fix encoding of generated pdf using Dompdf
I'm using Laravel 9 and Dompdf to generate some pdf files.
And the blade that I'm calling for the pdf files, contains persian/farsi/arabic character languages and therefore the final result will be ...
0
votes
1
answer
38
views
How to check that entered value of one these form inputs are not repeated at the other input
I have added this Controller method and I need to make sure that the entered number for one of the inputs (banner_one_priority, banner_two_priority, banner_three_priority, banner_four_priority, ...
0
votes
0
answers
1k
views
Laravel 5.8 Application Print to Local Thermal Printer
I inherited a Laravel 5.8 Application that I need to add some features to. The first feature is a printing mechanism to print to a thermal printer (in this case, the MUNBYN Receipt Printer, Thermal ...
1
vote
2
answers
296
views
What is wrong with this form validation
I'm working with Laravel 5.8 and I have made this Controller method for creating some records inside the DB.
public function doTheUpload(Request $request)
{
try{
$request->validate([
...
0
votes
2
answers
430
views
Getting weird undefined foreach error in Laravel Blade
I'm working with Laravel 5.8 and I have this syntax:
@php($counter_foreach = 0)
@foreach($memnames as $mem=>$memname)
@php
@endphp
@endforeach
Now when I run this, I get syntax ...
1
vote
1
answer
126
views
Deleting a file from storage does not delete an image
I'm using Laravel 5.8 and I wanted to delete an image from storage directory.
Basically the images is placed at this dir:
/storage/app/public/laboratories/labs/21/pics
And I tried running this method:...
0
votes
0
answers
360
views
Laravel 5.8 throws "Target [Illuminate\Database\Seeder] is not instantiable." on db:seed
The title basically summarises the question, but here's what I tried.
database/seeds/DatabaseSeeder.php is truncated to it's bare form - no uses and the call() method is commented. Still, I cannot run ...
1
vote
1
answer
361
views
htaccess rewriterule to specific laravel route
I have two different htacces. One on the root of project and the other one on a subfolder:
root
.htaccess
api
.htaccess
I need to rewrite rule to a specific route on api folder.
In the first ....
-1
votes
1
answer
958
views
BadMethodCallException: Method Illuminate\Support\Collection::OrWhereIn does not exist
In Laravel 5.8
At controller
I have this code
$products = DB::table('products as p')
->select(
DB::raw('p.id AS product_id'),
DB::raw('p.name AS ...
1
vote
1
answer
2k
views
How to add dynamic sum total [Footer] to an array column in laravel excel version 3.1?
I'm using this reference here > https://docs.laravel-excel.com/3.1/exports/collection.html
I use version 3.1 of Maatwebsite to map the data and extract it via excel file.
This is my controller ...
0
votes
1
answer
715
views
Laravel Excel Import pathinfo() expects parameter 1 to be string, object given
I'm using LaravelExcel and I want to load an Excel file on my project from a form, so I tried this:
use Maatwebsite\Excel\Facades\Excel;
public function postDocuments(Request $request)
{
try {
...
0
votes
1
answer
548
views
Laravel 5.8: parse_url() expects parameter 1 to be string, array given
I want to insert some data into the DB like this via Eloquent:
public function postDarkhast(Request $request)
{
RequestTable::create([
'course_name' => 1,
'...
0
votes
1
answer
314
views
Auth0 upon laravel 5.8 unable to authenticate an endpoint: Auth0\Login\Auth0Service::__construct() must be of the type array, null given,
I try to authenticate an endpoint using the auth0 library on an existing laravel 5.8 application (I know I need a serious upgrade but ain't got time):
$ composer require auth0/login
$ php artisan ...
0
votes
1
answer
954
views
How to show the icon of success message with Sweetalertjs in the Controller
I'm using Laravel and Sweetalertjs v2 and I wanted to show a success message at the Controller method:
alert("Submitted successfully","submitted");
And the alert successfully ...
0
votes
2
answers
517
views
how to take custom amount of data from foreach loop php laravel
So in Eloquent there is a take() and skip() functions works like this:
$users = DB::table('users')->skip(10)->take(5)->get();
But now I'm reading data from a json file:
$path = storage_path() ...
1
vote
2
answers
674
views
How to convert timestamp to Persian at Laravel Migration
I have this GET table and as you can see at the end of it, I have added members.created_at to return the date that user is registered on the website:
class CreateRegisteredStudentInfoView extends ...
0
votes
2
answers
1k
views
Undefined property: $client while trying to get some information
I'm using Laravel v5.8 and guzzlehttp of v7.4 and tried to write this Controller for getting some information:
public function __construct()
{
$client = new Client(['base_uri' => '...
0
votes
0
answers
2k
views
Forbidden You don't have permission to access this resource
I just added a directory to my public directory of Laravel 5.8 project which is on Live Server but faced this error:
Forbidden
You don't have permission to access this resource.
And at the public ...
2
votes
0
answers
226
views
404 Not Found - on Laravel 5.8 when the route already exists
I have a laravel 5.8 project on a hosted site and I recently added JWT Authentication in order to create APIs for mobile applications. Every API I have created is working fine and sending a proper ...
0
votes
0
answers
798
views
Laravel mail::table not rendering a table
I had a problem on my mail::table in Laravel Markdown Mailables. The table is not rendering. I have also no indents on it.
emails/inquiry.blade.php
@component('mail::message')
#New Inquiry
We have ...
0
votes
1
answer
280
views
How to add required if validation rule if a file has been uploaded
I'm working with Laravel 5.8 and here is my validation request form:
public function rules()
{
return [
'art_audio_file' => ['nullable', 'file', 'mimes:audio/mpeg,mpga,mp3,...
1
vote
0
answers
201
views
How to pass a parameter from a Laravel controller to a model hasmany function
I have an app with categories and subcategories, and I need to translate all of them to multiple languages. I want to retrieve all of the categories with their subcategories, along with any ...
1
vote
1
answer
3k
views
SweetAlert2: Unknown parameter "onBeforeOpen"
I'm using Laravel 5.8 and Sweetalert v2 and I tried firing this alert with it at the Blade:
Swal.fire({
title: '<h4 style="color: #0c5460;">Updating user status</h4>',
...
1
vote
0
answers
247
views
How to submit session in API routes
I want to submit a session at api. So at api.php, I did this:
Route::prefix('v1')->namespace('Api\v1')->group(function(){
Route::get('/test', function () {
session()->put('...
2
votes
1
answer
581
views
Get files from FormData object in laravel 5.8 sent over via Axios in Vue
I have a Laravel & Vue application where I want to upload files along with other data via axios but when I send the form, I do not see the files there in laravel.
Here is my HTML form:
<form @...
0
votes
2
answers
725
views
How to send session in Laravel API Controllers
I'm working with Laravel 5.8 and I'm trying to build my API for mobile app developer.
Basically I have made an API RegisterController that has a method like this:
public function register(Request $...
-1
votes
1
answer
99
views
Laravel Restful Api: Trying to get property of non-object
I'm working with Laravel 5.8 and I wanted to return some specific data of an Article.
So I made this Api Controller:
class ArticleController extends Controller
{
public function index()
{
...
-1
votes
5
answers
1k
views
What is your alternative for not using session in REST API in this case
I'm using this method for my API controller:
public function register(Request $request)
{
// Validation Data
$validData = $this->validate($request, [
'user_input' =&...
0
votes
4
answers
568
views
How to get related records for a single record in Laravel 5.8?
I have a registration table where the situation is that I have a table for months and a table for years. The relationship between months and registration is one-to-many and same is the case with years ...
1
vote
1
answer
129
views
How to use Rewrite this code with GuzzleHttp
I wanted to use Http facade in Laravel 5.8 but I noticed that Http facade is not included in this version of Laravel so I installed GuzzleHttp.
But now I don't know how to rewrite this code with this ...
0
votes
1
answer
2k
views
GuzzleHttp Can't Be Installed On Laravel 5.8
I'm working with Laravel 5.8 and I wanted to install GuzzleHttp package.
Firstly I tried running composer require guzzlehttp/guzzle, but I got this error:
Problem 1
- guzzlehttp/guzzle[7.4.0, ..., ...
0
votes
0
answers
959
views
SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value Laravel 5.8
SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value (SQL: insert into reports (patient_name, gender, ic, phone, current_location, status, emg_code, updated_at, created_at)...
2
votes
2
answers
274
views
How to add custom variable to URL Request of controller in laravel?
I have added this to the Controller:
public function updateMethod(Request $request)
{
$i = 1;
dd($request->input_name_1);
}
Now I wanted to change to this:
public function updateMethod(...
0
votes
2
answers
117
views
Foreach loop does not add counter
I have this custom foreach loop at Blade:
<div id="dynamic_field">
@foreach($niloufars as $niloufar)
@php
$counter = 1;
@endphp
<div class=&...
0
votes
1
answer
196
views
Install `laravel` error `could not find driver`
Install laravel error could not find driver
问题:
The version of laravel is 5.8.38
The version of php is 7.4.3
The version of mysql is 8.0.21
I get the error could not find driver when installing ...
-1
votes
4
answers
1k
views
Email verification does not seem to be sending anymore
I want to send email verification when a user signs up with a new Email Address. So at the Register Controller I added this:
public function register(Request $request)
{
if(Session::has('email')...