Questions tagged [laravel-5]

18080 questions
1

votes
1

answer
253

Views

How to write ternary operator inside laravelcollective form tags

I am using laravelcollective in blade template to define forms and facing the following issue. If i am using HTML in balde template it's working fine. HTML: ; LaravelCollective: {!! Form::text('email', null, [ 'class' => 'form-control ($errors->has('email')) ? ' is-invalid' : ''', 'placeholder' =...
Kiran Kumar P
1

votes
0

answer
499

Views

user has more than max_user_connections active connections

I have laragon as server on local machine. I am working on Laravel project. I used to face following error. SQLSTATE[HY000] [1203] User test_develop already has more than 'max_user_connections' active connections (SQL: select * from information_schema.tables where table_schema = test_develop and tab...
Jass
1

votes
1

answer
485

Views

Looks like I encountered an error (error #404) in mautic

recently install mautic 2.8.1, after setup api ,authorized it in auth2, after so many try it only gives output: Looks like I encountered an error (error #404). If I do it again, please report me to the system administrator! Do you have any idea, about this how to resolve this issue.
vinod bhandary
1

votes
1

answer
485

Views

Type error: Argument 2 passed to with() must be callable or null, object given

Route::get('/',function (){ $collection = collect(['product'=>'chair','price'=>100]); //dd($collection); return view('welcome')-with('prices',$collection); }); I want to pass $collection on view but I get this error: Type error: Argument 2 passed to with() must be callable or null, object given...
sava milin
1

votes
0

answer
289

Views

Show data into Select tag in Laravel

I need to get data into select tag in laravel,i am using html tags to show data in laravel. i have company and branch, i need to select a company and type branch under a compnay so i need to list company and select a compnay but it show error variable compnaies not found,please help me to fix this C...
Abhijith
1

votes
2

answer
109

Views

algolia Instantsearchjs how to display and search using <Searchbox> globally on an ecommerce website

Im using instantsearch.js , my website is an ecommerce application in laravel and algolia is working perfect on hits page. My main question is how can I implement SearchBox in other webpages (home, static, etc) allowing people to write on header searchbox and when they press enter -> be forwarded to...
s_h
1

votes
0

answer
124

Views

Laravel didnt find PHP Library RdKafka

I'm getting Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Class 'RdKafka\Producer' not found But the library is loaded at php.ini, when i try with php artisan tinker, it works, but doesn't work in the web application
Ariel Conti
1

votes
0

answer
346

Views

Simple mobile app to Laravel API authentication with Passport

Laravel 5.6 I need to create a way for the mobile app users to be able to register an account in a Laravel based app and then log in and gain access to the API. All user data and credentials will be stored in Laravel App. The mobile app will have to be authorised as long as the user doesn't log them...
Varin
1

votes
0

answer
300

Views

Why I cannot set Config for jwt-auth providers using PHP Laravel 5.6?

I have two different models and need to authenticate each. The first model is working fine which is predefined in the config/auth.php but when I try to set config for second model, it doesn't work. I have the following code for second model: public function loginParent(Request $request) { Config::se...
Maihan Nijat
1

votes
2

answer
447

Views

How to change the time zone in the model without touching the main time zone of the framework?

How can be changed timezone on created_at field of User model? For example now app timezone is UTC and I must change timezone created_at field to Europe/Paris and updated_at field timezone to Europe/London before save data to database. I have sample code to change field timezone. But I don't know wh...
Andreas Hunter
1

votes
0

answer
99

Views

How to solve utf8_encode issue in laravel 5.2?

If my application, i am fetching all posts data using eloquent models and sending its response as json to another application, if the post content contains any special character it is showing following error, after a long search i solved it by using $post->content = utf8_encode($post->content); now...
prudhvi259
1

votes
1

answer
192

Views

Google Cloud Printing with Laravel not working

I am creating a code for printing my HTML view via Google Cloud Printing. This is the package I am working with. https://packagist.org/packages/bnbwebexpertise/laravel-google-cloud-print I am getting 'errorCode':8,'message':'User is not authorised.' $data = GoogleCloudPrint::asText() ->content('This...
Jishad
1

votes
0

answer
120

Views

Laravel and 3+ table pivot

I'm trying to wrap laravel around a relatively basic structure - users with roles in multiple organisations, as in a single user can have many roles in many organisations. This allows a user to have a single set of sign-in credentials with different access depending on the organisation they're actin...
Hitunen
1

votes
1

answer
709

Views

laravel 5.6 query builder where orWhere not working

I have a page where both live and past papers should be shown but when the live paper time expires the live papers should not be loaded and only the past paper should be shown based on the time. the query currently used, $curdate=Carbon::now(); $papers = DB::table('papers') ->join('payments','papers...
1

votes
0

answer
1.5k

Views

Reset password not working properly in laravel

I am working on a project in Laravel, In my project login, registration, send forget password mail working fine. But when I am trying to reset the password Every time I am getting error. This password reset token is invalid. I have no idea, Why I am getting this error. Just noticed that Every time i...
Yogendra
1

votes
2

answer
489

Views

Multiple Laravel Apps with a Singe Redis instance

Is it possible to run two Laravel apps on a single Redis server without key name collisions? I did not see documentation for setting a namespace or adding a cache prefix. https://laravel.com/docs/5.6/redis
Justin
1

votes
0

answer
34

Views

how to write routes in a laravel + vuejs 2 + vue-router + vue-axios project?

this is how i've set the files in /ressources/assets/js/ file: /js/router/index.js & /js/router/mainRoutes.js, i wish to put my routes in mainRoutes.js /js/store/index.js for state management (this is how i code in a solely vuejs project) my app.js file: const app = new Vue({ el: '#app', router, st...
Michel Tchoutang
1

votes
0

answer
52

Views

Lumen/Laravel - use custom router

Is there any out of the box solution without changing core to add custom router in to laravel or lumen. I already know that lumen is using different router from laravel, so I am wondering is there any possibility builded in core to change router?
Dejan Milosevic
1

votes
1

answer
222

Views

Conversion of eloquent result to use with c3.js

I need to generate a pie chart whose output will be a representation of eloquent output. My query is: $data = MyModel::select('province_id', DB::raw('COUNT(id) AS cnt')) ->groupBy('province_id') ->get(); dd($data) gives me: Then it is passed to blade view as: return view('tool.charts', ['data' => $d...
Lakmal Premaratne
1

votes
0

answer
76

Views

How to create a validator laravel

validation to input multiple files. This is my validator script : $validator = Validator::make($request->all(), [ 'raport1.*' => 'required|mimes:jpeg,pdf,png|max:1024', 'raport2.*' =>'required|mimes:jpeg,pdf,png|max:1024' ]); and this script multiple select form: and my form format: the validator c...
Siti Rahmah
1

votes
1

answer
388

Views

Laravel Firebase Mobile Number (OTP) authentication

Is there any best way to integrate Firebase mobile number (otp) authentication to Laravel ? or any package ?
Myat Zuckerberg
1

votes
1

answer
327

Views

mime type of uploading file is application/octet-stream fails

I have a form for uploading pdf document and am using laravel validation in my controller like, $validator = Validator::make($request->all(), [ 'document' => 'required|mimes:jpeg,jpg,png,pdf|max:25600', ]); some of the images and pdf documents mime types like application/octet-stream is there any wa...
Naveen
1

votes
1

answer
76

Views

how to filter related tables by date in Laravel?

I have 2 related tables and I need to filter the date of a table by month My first table have the following fields: Id_agendamien_persona , Id_agendamiento, id_persona The second table have the following fields: Id_agendamiento, fecha so I need to filter fecha in the second table, Mi controller pub...
robert popi
1

votes
0

answer
698

Views

Remove index.php from laravel 5.6

How to remove index.php from http://localhost/lvoffc/index.php/login where 'lvoofc' is the name of my project. http://localhost/lvoffc/index.php/login---> Working http://localhost/lvoffc/login---> Shows 'The requested URL /lvoffc/login was not found on this server.' http://localhost/lvoffc/index.ph...
Vik
1

votes
1

answer
45

Views

Laravel how to get count specific data by school id?

I have laravel queries below $school = DB::table('sekolah')->get(); $morning_session = DB::table('sekolah')->join('pelajar', 'sekolah.sekolah_id', '=', 'pelajar.sekolah_id') ->where('pelajar.pelajar_sesi', 'like', 'Morning')->groupBy('pelajar.sekolah_id')->count(); $afternoon_session = DB::table('...
MrlinY
1

votes
1

answer
119

Views

Laravel eloquent firstOrCreate interval of dates

Is there a way to use firstOrCreate with an interval of dates. I know you can use: Model::firstOrCreate(['field' => $value], ['created_at' => $dateValue]); But is it possible to check if the record exist between the last few days?
J. Avalos
1

votes
1

answer
57

Views

Longchain relationship in laravel

I have three models Post.php being primary model that is in relation with other two model Category.php & Tags.php that are in following manner: class Post extends Model { public function category() { return $this->belongsTo('App\Category', 'category_id'); } public function tags() { return $this->...
Tanja Forsberg
1

votes
0

answer
80

Views

how to get form data and insert into whmcs in laravel

My Route code is shown below: Route::get('insert', '[email protected]'); Route::post('insert', '[email protected]')->name('product.insert'); My action code is as follows: My controller code is given below: class ProductController extends Controller { public function insertform(){ r...
sharmila
1

votes
1

answer
290

Views

session_start is failing to create session ID

I'm working in PHP 7.1 with Laravel 5.5. The error thrown is: Failed to create session ID: memcached (path: localhost:11211) The code causing the error is: if (session_status() === PHP_SESSION_NONE) { session_start(); // error on this line } My sessions are supposed to be files, which are successful...
amflare
1

votes
1

answer
1.1k

Views

Show all images in folder in Laravel 5.6 with blade

I have a page made with pure PHP. Now I want to do it with Laravel and Blade. I have this code in PHP to view a slideshow of images that are inside a folder but I do not know how to do this with Laravel. The main problem is access to the images folder. This is the pure PHP code: $dirname = '../img/f...
Br0wn
1

votes
1

answer
19

Views

How to resolve issue from laravel 5

I am receiving this error when I try to get the value from database to edit bus type form text box. Property [name] does not exist on this collection instance. (View: E:\fyp\resources\views\buses\editbustype.blade.php) Here is the code for edit section of controller: public function edit(addbustype...
HamXa Xia
1

votes
1

answer
1.3k

Views

Handling PostTooLargeException in Laravel 5.5

I am trying to handle PostTooLargeException in my Laravel 5.5 application. When I trying to upload too big file through my form I receive PostTooLargeException which I successfully catch in app\Exceptions\Handler.php, but on that step I would like to redirect user back to the page with form and show...
lubart
1

votes
1

answer
388

Views

Laravel 5.5 | Redirect main domain to public folder

I have laravel 5.5 project uploaded to live hosting on /public_html/commerce. When I go to domain.com/commerce/public then everything looks working perfectly. But when I point the domain directly to commerce/public, so; when I visit domain.com then all links got broken like this: domain.com/product/...
CairoCoder
1

votes
0

answer
30

Views

Laravel 5.4 Eloqent relationship query return null using ->first()

I hope anybody can help me with this. I have the next eloquent query: $chats = Solicitud::with(['reservation', 'detail.subDetails', 'conversation'=>function($q){ $q->orderBy('created_at', 'DESC')->groupBy('solicitud')->first(); }]) ->whereIn('idSolicitud', $r) ->skip($inicio) ->take($elementos) ->or...
Jorge Mejia
1

votes
1

answer
55

Views

Laravel - Edit product with polymorphic relation

I have a system where to user needs to be able to change a product. But the problem is, This product has a polymoprhic relation with theme. This is the build-up Products - ID - productable_id (For instance '1') - productable_type (Is either 'App\Theme'or 'App\Plugin') - name (Just a name) - descript...
Rainier laan
1

votes
1

answer
424

Views

How can I add condition on vue component that is loaded from the view blade laravel?

My view blade laravel like this : @extends('layouts.app') @section('content') ... ... @endsection @section('modal') @endsection The view blade laravel load two vue component. That are transaction component and transaction modal component. So if the view blade executed, it will run the components My...
Success Man
1

votes
0

answer
17

Views

Data does not display in my datatable

Good day. can someone help me why the data will not display in the data table if I used this code below in my return statement $unpaid= ['1', '2', '3', '4']; //Sample $paid= Datatables::of($query)->make(true)->getData(); return ['paid' => $paid, 'unpaid' => $unpaid]; Response {paid: {draw: 0, record...
Novice
1

votes
1

answer
104

Views

Laravel query with regexp performance improvement

I am using laravel 5.3. I have a big table (1.2 million rows). there is a text column named comment. I wrote this query - $regexp = 'good | bad | nice'; $temp1 = $connection->table('table1') ->select('*') ->where('comment', 'NOT REGEXP', $regexp) ->paginate(30); $regexp contains nearly 500 words. B...
DEV
1

votes
1

answer
363

Views

Laragon, laravel symbolyc link does not work

I'm using laravel with laragon, everything works fine exept that when I upload images they return 404 , and public/storage is empty however storage/app/public has the files , also public/public has the files , so it creates a wrong folder public inside the public folder, I did run the php artisan st...
Mikail G.
1

votes
1

answer
1.1k

Views

Laravel Eloquent Model save() doesn't update database

I'll start by saying yes, I have looked this us, and no, none of the fixes for other people seem to work for me... So I have a player model which I want to update a particular field on. I submit an ajax request, and have it update the relevant field. This model uses a customised primary key. Player...
Kieran

View additional questions