المشاركات

عرض المشاركات من أكتوبر, 2022

Getting a 500 Internal Server Error Jquery

While everything is running in the software, I get this error when I make a selection from the dropdown list in only one part. Where am I making a mistake? or is it a server error? I have not received this error in any Laravel before. When trying to get something from a dropdown list, this error comes to the console and there is no reaction on the site. https://prnt.sc/vaujzf <script type="text/javascript"> $("ul#product").siblings('a').attr('aria-expanded','true'); $("ul#product").addClass("show"); $("ul#product #adjustment-create-menu").addClass("active"); var lims_product_array = []; var product_code = []; var product_name = []; var product_qty = []; $('.selectpicker').selectpicker({ style: 'btn-link', }); $('#lims_productcodeSearch').on('input', function(){ var warehouse_id = $('#warehouse_id').val(); temp_...

Laravel Error Whoops, looks like something went wrong. 2/2 ErrorException in path/storage/framework/views/44812f12bcefe0281da2f29a7f94d872 line 40

I got an error as follow and I don't understand it. Is that a session issue. 2/2 Whoops, looks like something went wrong. ErrorException in /path-to-app/storage/framework/views/44812f12bcefe0281da2f29a7f94d872 line 40: Trying to get property of non-object (View: /path-to-app/resources/views/backend/base/clients/companies/peoples/index_all.blade.php) 1/2 ErrorException in 44812f12bcefe0281da2f29a7f94d872 line 40: Trying to get property of non-object from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Gf6hXL via IFTTT

How to store pdf file using filesytem and retreive it through sql database in laravel?

Hope you are fine. Please help me with this issue. I want to generate the pdf invoice automatically by pressing the button and save it filesystem and also save its path in the SQL database when I need to access these invoices it can be easily accessible from the SQL database. Thank you. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2JnGKwR via IFTTT

Laravel how can I run two redirect with each other simultaneously?

I'm trying to execute two redirect at the same time, but I don't know how to display this correctly in Laravel. Laravel 5.7 is used. Here is my code: public function store(Request $request) { $validatedData = $request->validate([ 'name' => 'min:2|max:50', 'details' => 'nullable|max:255', 'image' => 'nullable', 'tournament_id' => 'nullable', ]); $team = Team::create($validatedData); return redirect() ->route('tournaments.show', $tournament) ->with('success', 'Team erstellt'); return redirect() ->route('teams.show', $team) ->with('success', 'Team erstellt'); $errors = $validator->errors(); $tournament = Tournament::where('id', $t...

image not linked from storage folder to public

i have saved image given path storage/app/public/image/image.jpg but not able to call them, also used given command.working on local server but not live. php artisan storage:link from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3oJMkdg via IFTTT

How can we pass a variable from script inside php and set it to new a variable?(Updated)

صورة
How can we pass a variable from script inside php and set it to new a variable? I want to calculate the user location and the destination location by their coordinates but first I want to get the user coordinates which is already given in the script. <?php function distance($lat1, $lon1, $lat2, $lon2, $unit) { if (($lat1 == $lat2) && ($lon1 == $lon2)) { return 0; } else { $theta = $lon1 - $lon2; $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); $dist = acos($dist); $dist = rad2deg($dist); $miles = $dist * 60 * 1.1515; $unit = strtoupper($unit); if ($unit == "K") { return ($miles * 1.609344); } else if ($unit == "N") { return ($miles * 0.8684); } else { return $miles; } } } $mResult = distance($lat, $long, 29.46786, -98.53506, "M") . " Miles<br>"; $kmResult = distance($lat, $long, 29.46786, -98...

How to display Thai text with proper word wrap in PDF?

I'm using Laravel Framework to develop a pdf generated by using variables from Controller and display in THAI language. The problem is whenever THAI language is displayed and justified. It's not in the correct form. For example, the string "พัฒนาสำเร็จเทคโนโลยีผลักดันนานาชาติทรัพยากรส่งเสริมเอสเอ็มอีระดับสากลจัดการคุณธรรมโทรคมนาคมวิสาหกิจบริหารสตาร์ทอัพสร้างสรรค์จิตวิญญาณสนับสนุนลงทุนโลกาภิวัฒน์สตาร์ทอัพผลักดันยุคใหม่ลงทุนเอสเอ็มอีจริยธรรมนวัตกรรมผสมผสานเป้าหมายก้าวหน้าสำเร็จล้ำสมัยคุณธรรมพลเมืองเทคโนโลยีโลกาภิวัฒน์ความสัมพันธ์บูรณาการสร้างสรรค์บริหารพันธกิจสร้างสรรค์พลังงานเทคโนโลยีบริหารเอสเอ็มอีสตาร์ทอัพคุณธรรมสำเร็จจัดการจิตวิญญาณยุคใหม่มุ่งมั่นวิสาหกิจวาทกรรมสุขภาวะสนับสนุนต่างประเทศกระแสเป้าหมายอาเซียนกระแสวิสาหกิจสนธิกำลังสุขภาวะเป้าหมายบูรณาการเทคโนโลยีเทคโนโลยีผสมผสานพลังงานบริหารเป้าหมายผลักดันโครงสร้างระดับสากลพันธกิจวาทกรรมทรัพยากรพัฒนาระดับสากลทรัพยากรจิตวิญญาณกระแสจัดการส่งเสริมต่างประเทศสตาร์ทอัพคุณธรรมสุขภาวะเทคโนโลยีวาทกรรมโครงสร้างประชารัฐโลกาภิวัฒน์บริหา...

How to change the column names used in Laravel Auditing Package?

I'm currently trying to use Laravel Auditing v4.1 , yes, I know it's end of support and due to legacy issues I can't use the newer one. The issue is, there are two apps, that will be referencing the same audit table. The old app, was using the older version of Laravel Auditing where the column names are different to the version 4.1. So what I was trying to do is map the saving of the audit record referencing to the old column names. Anyway, what I tried so far: Using a custom model. Changed the implementation value under config/audit.php to my own model App\Models\CustomAudit namespace App\Models; use Illuminate\Database\Eloquent\Model; use OwenIt\Auditing\Audit as AuditTrait; use OwenIt\Auditing\Contracts\Audit as AuditContract; class CustomAudit extends Model implements AuditContract { use AuditTrait; /** * {@inheritdoc} */ protected $guarded = []; /** * {@inheritdoc} */ protected $casts = [ 'old_value' => '...

laravel validation does not work with Auth

I am trying to add validation in the controller but it does not work with auth:check. This is the Laravel version 5.7. This is the function store that has a problem with the validation. public function store(Request $request) { $request->validate([ 'first_name' => ['required'|'min:2'|'max:50'] ]); if(Auth::check()){ $player = Player::create([ 'first_name' => $request->input('fist_name'), 'last_name' => $request->input('last_name'), ]); if($player){ return redirect()->route('players.show', ['player'=> $player->id]) ->with('success' , 'foo'); } } return back()->withInput()->with('errors', 'Foo Error'); } from Newest questions tag...

Laravel wrong limit inside function with

There are three models User Post and Image . The user has many posts, posts have many images. Also, there is a user_images function - it's hasManyThrough function. All relations work well. During the search, I wanna get users with images(max 3 for every user) and do something like that: $users = User::where('is_active', true) ->with([ 'user_images' => function ($relation) { $relation->limit(self::LIMIT_IMAGES); } ])->get(); Response: [ { "id": 265, "user_images": [ { "id": 309, "path": "url" }, { "id": 308, "path": "url" }, { "id": 306, "path": "url" } ] }, { "id": 305, "user_images": [] } ] As you can I have ONLY 3 images for all users,...

Markers are missing when calling it dynamically

Most of the Markers are missing when calling it dynamically. Here is my code. I am beginner in Laravel. The Sports variable contains various sports name, marker image for each sport name, popup image for each sport name etc. The Mapevents contains different/ repeated sport names with different latitude and longitude. While try to mark in Map using Markers most of the Map events are not displaying. <script type="text/javascript"> (function(A) { if (!Array.prototype.forEach) A.forEach = A.forEach || function(action, that) { for (var i = 0, l = this.length; i < l; i++) if (i in this) action.call(that, this[i], i, this); }; })(Array.prototype); var mapObject, markers = [], markersData = { @foreach($mapevents as $event) @foreach($sports as $sport) @if($event->category_id==$sport->id) '': [ { name: 'Events', location_latitude: "", ...

Calling Artisan Commands from other Artisan Commands using different .env

I want to use .env.testing and I read here : You may also create a .env.testing file. This file will override the .env file when running PHPUnit tests or executing Artisan commands with the --env=testing option. I have an artisan command that should create my testing database. The command is triggered using php artisan testdb:fresh and calling another command in his handle method: public function handle() { if ($this->isProduction()) { $this->errorMessageTestingDatabase(); return; } $this->call('migrate:fresh', ['--env' => 'testing', '--seed' => true]); } However, it seems that the --env=testing flag is ignored. I get a failure to connect to db exception. However, if I run the command by php artisan testdb:fresh --env=testing It works. It it not possible to pass an env flag when calling an Artisan command withing an Artisan command? from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/34B...

Is this Mysql Bug? About SELECT ... FOR UPDATE lock_mode X insert intention

صورة
have a table struct is id, aid, ...... the aid is an index(a type of int) trx1 and 2: begin; trx1: select max(id) from a where aid = 10 for update; trx2: select max(id) from a where aid = 10 for update; ## have blocked waiting trx 1 trx1: insert into a (........; then trx 2 will throw a deadlock even not commit yet this error can't throw out in PHP, no error in PHP and MySQL. just-auto rollback then continues to execute other code. change MySQL query order below: trx1 and 2: begin; trx1: select max(id) ... for update; trx1: insert ...; trx2: select max(id) ... for update; trx1: commit; the trx2 result is currectly my MySql version is 5.7 I was saw(the same kind of type question): Solution for Insert Intention Locks in MySQL and this: https://bugs.mysql.com/bug.php?id=25847 for test code below: //prepared: CREATE TABLE `test_lock` ( `id` int(11) NOT NULL AUTO_INCREMENT, `aid` int(11) NOT NULL, `otherinfo` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), KEY `aid` (`aid`) ) E...

Get the first free column in a Google Sheet via PHP API

I'm using the Google Sheets API to write some data into the sheets, but so far either I clear it all and write everything again or I write in new rows (which Sheets API does by default). I am now writing a single column per run, but I need to get the first available column in the sheet, so I can pass it as the range of writing. This is my code so far: $sheet = new \Google_Service_Sheets($this->client); $range = "'" . $sheetName . "'!" . $rangeArg . (strlen($rangeArg) == 2 ? '' : count($data) + 1000); $response = $sheet->spreadsheets_values->get($this->sheetId, $range); if (!$clear && $response && $response->values) { $c = count($response->values); $newRange = (intval(substr($rangeArg, 1, 1)) + $c); $newRange = substr($rangeArg, 0, 1) . $newRange . substr($rangeArg, 2); $range = "'" . $sheetName . "'!" . $ne...

Facing facades issue in laravel

Fatal error: Uncaught RuntimeException: A facade root has not been set. in /app/dragonglass/crm/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:218 Stack trace: #0 /app/dragonglass/crm/app/helpers.php(617): Illuminate\Support\Facades\Facade::__callStatic('Header', Array) #1 /app/dragonglass/crm/app/helpers.php(556): getLoggerBasicData('Call to undefin...', '') #2 /app/dragonglass/crm/app/Exceptions/Handler.php(40): logError('Call to undefin...', '', Array) #3 /app/dragonglass/crm/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(314): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError)) #4 /app/dragonglass/crm/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(122): Illuminate\Foundation\Http\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError)) #5 /app/dragonglass/crm/public/index.php(53): Illuminate\Foundation\Http...

Timestamp comparison on where clause randomly working?

I have an old database where the column FastStart_start and FastStart_End are varchars. Using the Laravel query builder, the following query $referrals = \DB::table('users')->join('order_details', 'order_details.user_id', 'users.id') ->join('users as sponsor', 'sponsor.id', '=', 'users.sponsor_id') //->where('order_details.created_at', '>=', 'sponsor.FastStart_Start') ->where('order_details.created_at', '<=', 'sponsor.FastStart_End') ->select('users.username', 'users.email', 'order_details.created_at', 'users.sponsor_id', 'sponsor.FastStart_Start', 'sponsor.FastStart_End') ->get(); gives this outcome: #items: array:3 [ 0 => {#2792 +"username": "annalise92" +"email": "luisa...

How to access assets from resources sub folder in Laravel?

This is the javascript source in blade file. <script src=""></script> OR <script src=""></script> Both asset and URL::to doesn't work. The actual file path is: resources -> views -> template -> js error shows 404 not found on local xampp server. its working fine in production. project is copy of production code. I would appreciate for your kind support. thanks from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/31JOgbt via IFTTT

laravel post for image and textfield

The post created is to save the image and description to the DB but only the description gets saved. $post = new Post; $post->user_id = Auth::user()->id; $post->desc = $request->desc; //check if post has photo If($request->hasFile('image'){ $imageName = time().'.'.$request->image->extension(); $request->image->move('storage/posts', $imageName); $post->photo = $imageName ; } //mistake $post->save(); $post->user; return response()->json([ 'success' => true, 'message' => 'posted', 'post' => $post ]); } from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3kxrLOs via IFTTT

How to limit the telescope entries in laravel?

We are using telescope to monitor our laravel application. but telescope is using big amount of database. Yes we can delete records . But is there any way that we only allow telescope to insert record related to queues and schedule commands not all data like requests , database queries and many other things. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/31Mbuhb via IFTTT

After Module creation Laravel project give error

I have project botsolutionNew and I want to make module inside my project, but problem here is that after creating module the whole project is not running. It work fine when i disable module. I got the following errors after running my project Action Modules\Quickbooks\Http\Controllers\HomeController@index not defined. (View: F:\wamps\www\botsolutionNew\resources\views\layouts\partials\home_header.blade.php) from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2J0O3u3 via IFTTT

Sending temporary attachment to email not working in Laravel 5.8

I'm trying to send attachment from form input via Notification email but I keep getting " Serialization of 'Illuminate\Http\UploadedFile' is not allowed " error. This is my controller function: /** * @param InterviewRequest $request * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function interviewPost(InterviewRequest $request) { $contactForm = $request->all(); $contactForm['country_code'] = config('country.code'); $contactForm['country_name'] = config('country.name'); $contactForm = ArrayHelper::toObject($contactForm); if ($request->hasFile('filename')) { $contactForm->filename = $request->file('filename'); } // Send Contact Email if (config('settings.app.email')) { Notification::route('mail', config('settings.app.email'))->notify(new InterviewSent($contactForm)); } } This ...

Form validation on Laravel 5

I seem to have a problem with this function which is used in a contact form. This form was made by a developper I get this message displaying in a random way : "An Error Occured.." when I click Submit button in my form. Most of time I get this error message but on local I yesterday got it not displayed and bassed to the next step and validated the form. Problem is I was not able to reproduce it. I found the controler use a PostIndex function as follow public function postIndex($origin = '') { $input = Input::only('title','name','country_id','company','company_website','phone_number','email','message'); $input['origin'] = $origin; $input['ip'] = getIP(); // Create a new validator instance from our validation rules $validator = Validator::make($input, ContactUs::$rules ); // If validation fails, we'll exit the operation now. if ($validator->fails()) ...

What is best practice to save history in laravel?

We have big laravel application . In many controller method we are calling golbal helper function which is saving history. Here is our method. $user_id = $userId; $user_model = $userModel; $model = Consignment::class; $object_id = $consignment->id; $status = getConsignmentStatus($consignment->status); $comment = "Consignment has been created"; $visibility = "Internal Only"; //Hitory Helper function history($user_id, $object_id, $model, $status, $comment, $visibility, $user_model); History function function history($user_id, $object_id, $model, $status, $comment, $visibility = '', $user_model = null) { $history = new History; $history->user_id = $user_id; $history->object_id = $object_id; $history->model = $model; $history->status = $status; $history->comment = $comment; $history->visibility = $visibility; if (!e...

General Error with laravel General error: 1366 Incorrect integer value: for column image_id

i'm not sure what is wrong "message": "SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'C:\Users\roman\AppData\Local\Temp\php85A7.tmp' for column 'image_id' at row 1 (SQL: insert into foods ( name , description , price , offer_price , quantity , image_id , updated_at , created_at ) values (Hussain Wael, kasdhv;loasid, 100, 1, 12, C:\Users\roman\AppData\Local\Temp\php85A7.tmp, 2022-10-26 22:25:30, 2022-10-26 22:25:30))", store function public function store(FoodRequest $request) { $data = Food::create($request->all()); if ($file = $request->file('image_id')) { $path = $file->store('image'); $data['image_id'] = Image::create([ 'name' => $file->getClientOriginalName(), 'size' => $file->getSize(), 'path' => $path ])->id; } return $this->...

How to install package in old laravel project

صورة
I have a project built in laravel 5.8 and I want to add socialite package in this project but whenever I try to install the socialite package it gave me this error all the time. Here is my composer.json { "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": [ "framework", "laravel" ], "license": "MIT", "require": { "php": "^7.1.3", "anandsiddharth/laravel-paytm-wallet": "^1.0", "anhskohbo/no-captcha": "^3.1", "barryvdh/laravel-dompdf": "^0.8.6", "caouecs/laravel-lang": "~4.0", "cartalyst/stripe-laravel": "10.*", "doctrine/dbal": "^2.10", "fideloper/proxy": "^4.0", "guzzlehttp/guzzle": "~6.0", ...

Authentication In Laravel With Multi Auth

i am just learning the laravel version 5.4. i just made a simple blog post application using laravel with an website and admin panel So in navbar which is common for front side code looks like below @if (Auth::guest()) <li><a href="">Login</a></li> <li><a href="">Register</a></li> @else <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"> <span class="caret"></span> </a> </li> And In controller class PostController extends Controller { public function __construct() { //$this->middleware('auth:user'); << i also tried thi $this->middleware('auth:user')->except('index','show'); } So the problem is i wants to allow all users to read blog...

I want to Create One to Many Relationship | with If Condition | (Category has many Subcategories)

I want to create a Category, if they have a parent categoryId then update the parent id, and categoryName on the subcategory Table . if they have not parent id then, it saves on the parent Category table with category name. Can you Correct my Relationship Code? I think it is wrong. and Very Thank you to Help me in category Model (parent) class Category extends Model { public function subcategories(){ return $this->hasMany(Subcategory::class); } } In the Subcategory Model, class Subcategory extends Model { public function category(){ return $this->belongsTo(Category::class); } } In controller, public function store(Request $request){ //dd($request->categoryid); if($request->categoryid){ $subcategory = new Subcategory(); $subcategory->name = $request->subcatname; $subcategory->save(); $category = $request->categoryid; //dd($category); $subcategory->category()-...

How to make URL from Laravel routes

I've got Laravel backend and I'm trying to make iOS to it, but there is no documentation. It is my first time with Laravel, so confused with the routes and middlewares. How do I compose URL from code below Route::middleware('auth:api')->get('/user', function (Request $request) { return $request->user(); }); // Passport authentication Route::group([ 'prefix' => 'auth' ], function () { Route::post('login', 'AuthController@login'); Route::post('signup', 'AuthController@signup'); Route::group([ 'middleware' => 'auth:api' ], function() { Route::get('logout', 'AuthController@logout'); Route::get('user', 'AuthController@user'); Route::resource('materials', 'MaterialsController'); Route::resource('packages', 'PackagesController'); ``` from Newest questions tagged laravel-5 - Stack O...

Migration Error: Syntax error or access violation: 1071 Specified key was too long in Laravel

I'm working with Laravel 5.6 and Mysql Version 5.7.3. Everything is working fine in Laravel Vagrant box. But when I deployed my project in VPS hosting with CentOS and run the command "php artisan migrate:refresh" it's raised error like "SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: a lter table products add unique products_bar_code_unique ( bar_code ))". How could I solve this issue? Thanks in advance. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3otSHRQ via IFTTT

Server Error (500) when starting my dockerized laravel app

I have created a laravel app and then created a Dockerfile : FROM php:7.4-cli RUN apt-get update -y && apt-get install -y libmcrypt-dev RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer RUN docker-php-ext-install pdo #mbstring WORKDIR /app COPY . /app RUN composer install EXPOSE 8000 CMD php artisan serve --host=0.0.0.0 --port=8000 Then I ran sudo docker build -t myApp . and sudo docker run -it -p 8000:8000 news-organizer . Everything worked fine. When I copy this folder (with Dockerfile) to another location and run composer update --ignore-platform-reqs , sudo docker build --no-cache -t theApp . and sudo docker run -it -p 8888:8888 theApp the Web App starts. When I enter 127.0.0.1:8888 I get the 500 Error . I already set all rights to sudo chmod 755 -R <myLaravelFolder> . I also tried setting different port numbers. The Dockerfile of the new folder is: FROM php:7.4-cli RUN apt-get update -y && apt-get in...

How to use gentelella alela select2 option in laravel

I found they have select2 file in their vendor folder, so i linked them (those links works when i open these two files in web browser). in header <link href="" rel="stylesheet"> in Footer <script src=""></script> in body <div class="item form-group"> <select class="form-control select2-multi" name="tags[]"> @foreach($tags as $tag) <option value=""> </option> @endforeach </select> </div> in body <script type="text/javascript"> $(.select2-multi').select2(); </script> but, still it not working.. this code found in here https://www.youtube.com/watch?v=BNUYaLWdR04&list=PLwAKR305CRO-Q90J---jXVzbOd4CDRbVx&index=43 from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3...

Laravel version upgrade with routes.php

Laravel had a routes.php file in older version. Which got changed into routes/web.php I am trying to upgrade the laravel from older to latest version. But my routes.php still exists and routes folder is not still created. Is this fine, because the code works fine till now. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3ora9Ge via IFTTT

how to deal with long task on laravel to avoid 504 error?

I'm trying to do a long task (upload file or foreach 100k rows query) but every time I get the 504 error. I have set nginx.conf , ini_set('max_execution_time', 300); and the set_time_limit(0) but nothing seems to work. What is the proper way to deal with long tasks, I mean, is there a way to send responses while doing the job? so the server and client keep communicating? so both parties know that the job isn't done yet? For example, I know the query have 100k rows, so I know is a long job. Or uploading a large file, I send chunks of it, knowing theres a lot of chunks, but keep getting the 504 error. Should I send responses for each loop? How can I do that? returning responses ends the job, so I don't know how to keep the task alive from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/37xHs4G via IFTTT

Display image in Vue from storage folder with laravel

I'm saving my images in following location Storage/app/public/userImages It is getting saved but when i retrieve it in my vue component it throws error 404 not found. <img :src="`/storage/${post.img_path}`"/> and the url which is created is http://localhost:8000/storage/userImages/872937058.png Please give any suggestions. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2FVgU1M via IFTTT

Hyn tenancy showing Query Exception 'the table 'db' is full when creating new tenant

I have been working on laravel angular project since last 6 months and now implementing hyn\multi-tenancy showing the error query exception: Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1114 The table 'db' is full (SQL: GRANT ALL ON `XYfeQKZivx`.* TO `XYfeQKZivx`@'127.0.0.1') And I don't have such table in my database. Tried almost everything from the Internet still unable to find the solution for the problem. Please any one help. Thank You. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3ksq8l4 via IFTTT

Joining two models in Laravel Eloquent

I have a model stored in a variable like: $user = User::where('name', 'like', $test) ->orderBy('name'); I would like to build another query where I can join $user . Can't find the right syntax to do it. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2HkR8F6 via IFTTT

Sent Thank-you email to visitors after form submit via Laravel 5

صورة
I'm trying to send out an email in Laravel 5 $mail = Mail::send('layouts.share.emails.confirm', array( 'message' => $contact->message, ) , function ($message) { $message->from(env('MAIL_FROM') , 'www.jdoe.com'); if(env('APP_ENV') == 'local'){ $message->to($email , 'Cyb3r 8200')->subject(' Thank-you from '.env('APP_URL')); } else { $message->to($email , 'Cyb3r 8200')->subject(' Thank-you from www.jdoe.com '); } }); I kept getting message: "Undefined variable: email" Any hints for me ? from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2HtjsVF via IFTTT

How do I make header and sidebar stay in my project? [closed]

i want to call component of header footer and sidebar in one daseboard page. <x-app-layout> @include('/assets. Header') @include('/assets. Sidebar') @include('/assets. Footer') </x-app-layout> from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/35qVsKP via IFTTT

How to remove paginate in Laravel?

I need to remove the pagination and leave everything on one page, but this way I'm doing it only generates BUG. I wonder why the snippet of the commented code doesn't work to remove the pagination. whereHas('sizes', function($query) use($minParam, $maxParam) { if($minParam && $maxParam) { $query->whereBetween('max_capacity', [$minParam, $maxParam]); } elseif($minParam) { $query->where('max_capacity', '>=', $minParam); } else { $query->where('max_capacity', '<=', $maxParam); } })-> if ($minParam || $maxParam) { $products = Product::whereHas('sizes', function ($query) use ($minParam, $maxParam) { if ($minParam && $maxParam) { $query->whereBetween('max_capacity', [$minParam, $maxParam]); } elseif ($minParam) { $query->where('max_capacity...

laravel's environment file .env always clean itself during development

I face an issue when in development, my laravel's environment file : .env , usually clean itself whenever I update the client-side code (*.vue files). I'm using VueJS as client and running the run-time build/watch whenever we have some change, we can refresh the browser to see the change but usually, I don't know why it always clear the laravel .env file to a blank file. It's so annoy. Who might face the same issue? Any solution or way to find-out the root cause? Noted: In production, it's OK. (Laravel 5.8 / VueJS 2.x) from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/31w6cq4 via IFTTT

Upload Multiple images in Laravel using Vue.js

صورة
I'm trying to upload image using vue.js in Laravel for that i'm using this link https://jsfiddle.net/b412ruzo/ to upload image using vue.js and when i submit the form i'm getting following image in files array now issue is that i cannot get this file array in laravel controller when i print $request->file('files') in my controller i am getting null. and when i print $request->input('files') this is the result, an empty array Any help regarding this issue is highly appreciated. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2HtNzfq via IFTTT

How to combine or merge two nested arrays according to their index

Here is the formatted code: <?php $final_data1 = [ '6882' => [ 'observation' => '51', 'dom' => '4462', 'amenity_value' => '5900', 'amenity_id' => '6882', 'amenity_name' => '10 ft. Ceiling', 'unit_id' => [ '0' => '45349', '1' => '45350', ] ], '6842' => [ 'observation' => '0', 'dom' => '0', 'amenity_value' => '0', 'amenity_id' => '6842', 'amenity_name' => '11 Ft. Ceiling', 'unit_id' => [ '0' => '45317', '1' => '45531' ...

how to download csv file then redirect the page using laravel

I want to download the CSV file after that want to redirect the page on laravel controller.but does not work on the below code $downloadthefile=Response::make($return_data); Response.redirect('/app-sent-report'); from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3mpbX11 via IFTTT

Could .env and .env.example files differ in Laravel?

I have some custom configuration variables that only my company uses for the app. We have a dependency and we have to have those env variables to work that class but other people doesn't need those variables since they are not using the class we are using. So I have 5 more key=>value pair in my production .env which are not in .env.example, is this logical? Are there any other place that I should hold custom key variables other than .env from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2FOXfR1 via IFTTT

Laravel get file name from folder with File method

Cant figure out how to get file name from folder in ````filePath``` use Illuminate\Support\Facades\File; $filePath = storage_path('app/apiFiles/'.auth()->user()->id_message.'/'); $fileName = File::files($filePath); dd($fileName); dd($fileName) return array but i need only filename is possible to separated from array? what i need from array is only this filename: "Z1iZ03gEhltPZj2Z2Rxnnuga2eXywheL4pQc5q0I.zip" array:1 [▼ 0 => Symfony\Component\Finder\SplFileInfo {#293 ▼ -relativePath: "" -relativePathname: "Z1iZ03gEhltPZj2Z2Rxnnuga2eXywheL4pQc5q0I.zip" path: "/var/www/html/domain/storage/app/apiFiles/910960" filename: "Z1iZ03gEhltPZj2Z2Rxnnuga2eXywheL4pQc5q0I.zip" basename: "Z1iZ03gEhltPZj2Z2Rxnnuga2eXywheL4pQc5q0I.zip" pathname: "/var/www/html/domain/storage/app/apiFiles/910960/Z1iZ03gEhltPZj2Z2Rxnnuga2eXywheL4pQc5q0I.zip" extension: "zip...

using s3 storage Class 'SimpleXMLElement' not found

I am using digital ocean server and my site is in laravel and php 7.2 site is working fine but now I want to use amazone S3 storage space while I am entering s3 credentials in env file and run this site then it is showing this error ErrorException in PayloadParserTrait.php line 44: Class 'SimpleXMLElement' not found (View: /var/www/xxxxxxxx/xxxxxxxxx/resources/views/home/index.blade.php) please help me out about this problem. but when I use these credentials in local host it is showing this error ErrorException in WrappedHttpHandler.php line 195: Error executing "ListObjects" on "https://astrochest.s3.amazonaws.com/?prefix=cache%2Fcad2dc21%2Faveec8569429dbfa0cc9b.jpeg%2F&max-keys=1&encoding-type=url"; AWS HTTP error: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) (View: E:\wamp64\www\newastrochest\astrochest\resources\views\home\index.blade.php) from Newest que...

Laravel - File Upload button not working in live server

In the laravel project the file upload button was working fine during local development using WAMP Server. But when I uploaded the project to my shared hosting server, the file upload button does not work anymore. The button is disabled. In my localhost the upload button works, but in my live server the file upload button does not work(disabled) Pls help I don't know what to do. from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3dL8C9c via IFTTT

Space before %pdf in snappy pdf generation

I am using Snappy pdf and all things are working fine but I tried to upload on some websites then it says "PDF header is not at the start of file". I analyzed this error and found that this is because when i generate the pdf file then the pdf is taking space before the %pdf syntax. I opened the generated pdf in the notepad++. My config file is like this return array( 'pdf' => array( 'enabled' => true, 'binary' => base_path('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'), 'timeout' => false, 'options' => array(), 'env' => array(), 'margin-top' => 0, 'margin-right' => 0, 'margin-bottom' => 0, 'margin-left' => 0, ), Could you please help me to find a solution on how to remove this space when the pdf generate from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/31sKcfY via IFTTT

Saving selected option after validation in Laravel

I need help with saving a selected option after validation fails. Here is main.blade.php <form method="POST" action=""> <select id="searchEngine" name="searchEngine"> <option value="google">Google</option> <option value="bing">Bing</option> <option value="duckduck">DuckDuckGo</option> </select> @if ($errors->has('searchEngine')) <div style="background-color: #faa;"> @foreach ($errors->all() as $error) @endforeach </div> @endif </form> Controller looks like: request()->validate( ['searchEngine' => "required|in:google,duckduck"], ['searchEngine.in' => $searchEngine.' not working, try another'] ); I tried this, but it always returns only the last option: <option value="google" {!! $error...

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) with Laravel session

Suddenly I got 500 error in my laravel application and I did composer install and composer update . 500 Error was gone and I got Laravel error called as follows. Illuminate \ Database \ QueryException (1045) SQLSTATE[HY000] [1045] Access denied for user 'bec'@'localhost' (using password: YES) (SQL: select * from sessions where id = nEF6h6M0tWczE2pMn2pdwAZ2pHwPwlQN7KgTLQH2 limit 1) I tried below things. php artisan optimize:clear this is my .env DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=becmis DB_USERNAME=root DB_PASSWORD=secret I never faced this error with (SQL: select * from `sessions` where `id` = nEF6h6M0tWczE2pMn2pdwAZ2pHwPwlQN7KgTLQH2 limit 1) Please help me to get rid of this from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3m1W1Bi via IFTTT

How do you read the type file of input using sweetalerts in laravel 5?

I am using laravel 5.2 and sweetalert. I have a button for upload a file, and when I click the button, there is a sweetalert popup shown to upload the file. But when I submit it, it won't uploaded but no error message.. I tried to print the file but it shows nothing. I use this code too to insert the text type and it worked but not with the file type. Do you know how to read a filetype in sweetalert? This is the button code: <button id="uploadfile" data-id="" class="btn btn-success"><i class="fa fa-upload"></i></button> This below is my sweetalert code $('button#uploadfile').on('click', function(ID){ var ID = $(this).attr('data-id'); swal({ content: { element: "input", attributes: { placeholder: "Upload the file", type: "file", confirmButtonText: 'Upload', }, }, }) .then(...

Eloquent Relationship Count Constraint

I am trying to write an eloquent query that would work as follows: Tables: Order Support Ticket (one to many with the order) Query: Filter the support tickets and only show the order if the support ticket is less than 45 days old. I feel like this would be an adaptation of the whereHas() method in Laravel but I am not sure how to implement a filter or a date search on a relationship like this. Thanks! from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/37r81bt via IFTTT

Method update does not exist in Laravel

It is very simple code to update an existing entry. save() is working perfectly. But update is not working. Here is my code: Route::post('toggleFavourite',function(){ try{ $data = Request::all(); extract($data); $favourite = \ItScholarBd\Api\Models\Favourite::where(['user_id'=> $user_id,'shop_id'=> $shop_id])->get(); if(empty($favourite)){ $favourite = new \ItScholarBd\Api\Models\Favourite; $favourite->user_id = $user_id; $favourite->shop_id = $shop_id; $favourite->status = $status; $favourite->save(); }else{ $favourite->status = $status; $favourite->update(); } return response()->json(['status' =>1, 'data' => $favourite], 200); } catch (Exception $ex) { return response()->json(['status'=>0, 'status_text' => $ex->getMessage(...

How to upload file using sweetalerts in laravel 5?

I am using laravel 5.2 and sweetalert. I have a button for upload a file, and when I click the button, there is a sweetalert popup shown to upload the file. But when I submit it, it won't uploaded but no error message.. I tried to print the file but it shows nothing. Do you know how to read a filetype in sweetalert? This is the button code: <button id="uploadfile" data-id="" class="btn btn-success"><i class="fa fa-upload"></i></button> This below is my sweetalert code $('button#uploadfile').on('click', function(ID){ var ID = $(this).attr('data-id'); swal({ content: { element: "input", attributes: { placeholder: "Upload the file", type: "file", confirmButtonText: 'Upload', }, }, }) .then((myfile) => { if (myfile.value === false) return false; if (myfile....