Category : php-7

I working on the few of the small decimals like 0.0000687, 0.0000063241, 0.0000454. I used BCMath as to get the most precise result because it involved with money calculation, so far BCMath it is very helpfull to me in fixing my previous bug that I faced. But I found that BCMath cannot work well if ..

Read more

I want to get a list of all timezones. When I use DateTimeZone::listIdentifiers() I get a list, And when I use DateTimeZone::listAbbreviations() I get a list with different entries. Each list has values that are not in the second list. How to get a complete list? Why is there a difference between the two functions? ..

Read more

I am using Jquery Query Builder in an PHP application. https://querybuilder.js.org/ How can i prefix sql result with alias like this alias.column=value AND alias.column2=value2 AND alias.column3=value3 OR alias.column4=value4 my code is var sql = resH = ”; var result_json = builder.queryBuilder(‘getRules’); if(result_json) { var res = builder.queryBuilder(‘getSQL’); var resH = builder.queryBuilder(‘getHumanCond’); if(typeof res.sql != ‘undefined’) ..

Read more

I downloaded an open-source web application from GitHub called Electronic Document Management System (EDMS) from this link: https://github.com/hpbyte/edms I also tried following the step-by-step procedure on how to setup and install downloaded Laravel Web Applications from GitHub. I successfully logged in into the Web Application, and was able to land the dashboard: https://i.imgur.com/fa58Sij.png The problem ..

Read more

I am working on my local server right now and trying to get rid of ‘/public/index.php’ from http://localhost/example/public/index.php/ in the url. I have followed content from the site: https://www.tutsmake.com/how-to-remove-public-from-url-in-laravel/ and added the config file laravelex.conf with the following content: <VirtualHost *:80> ServerName localhost ServerAdmin [email protected] DocumentRoot /var/www/example/public <Directory /var/www/example> Options Indexes FollowSymLinks MultiViews AllowOverride All ..

Read more

I’m setting up a tidal observations endpoint using Fisheries and Oceans Canada SOAP web service (https://tides.gc.ca/eng/info/WebServicesWLD and https://ws-shc.qc.dfo-mpo.gc.ca/predictions?wsdl). It involves looking at an old application that’s in vanilla PHP, and porting it into Laravel. Both the vanilla and Laravel versions work, but for some reason in Laravel I can’t set the max size of the ..

Read more

I wanted to use beyondcode/laravel-er-diagram-generator to generate diagram of my Lumen app. Installation went smoothly with no issues. When I run php aritsan generate:erd I get: $ php artisan generate:erd In Php7.php line 1170: A trailing comma is not allowed here on line 71 I started investigation and I’ve found that this links to one ..

Read more

The code below works fine: $data = Structures::select("id", "parent_id", "category", "type", "subType", "variant", "description") ->orderBy(‘category’) ->orderBy(‘type’) ->orderBy(‘subType’) ->orderBy(‘variant’) ->get() ; return $this->fillCategories($data) ; The fillCategories() function fills a JSON tree with parent child relationships. However, the code below, doesn’t work. $data = DB::table("categories AS t1") ->select("t1.id", "t1.name AS category", "t2.id as typeId", "t2.name as type", ..

Read more

I’m using Laravel 8 to loop over some data. I’ve got my data out from my database, but am struggling to loop over the data in a foreach loop, it doesn’t appear to be giving me the key/value pairs, only the index/value pair? $applicationOptions = ApplicationOptions::where(‘form_type’, $form_type)->get(); foreach ($applicationOptions as $key => $value) { // ..

Read more

In my Laravel’s middleware I generate a custom header value. $correlationId = Uuid::uuid4()->toString(); if ($request->headers->has(‘Correlation-ID’) === false) { $request->headers->set(‘Correlation-ID’, $correlationId); } When I throw an exception I easily get it in Sentry along with my custom header. But the power of using Sentry and Correlation Id is when you tag something, each tagged value is ..

Read more

When the person is registered, I want a private e-mail to be sent to the name of the person, but I could not reach. my RegisterController; protected function create(array $data) { $user =User::create([ ‘name’ => $data[‘name’], ’email’ => $data[’email’], ‘password’ => Hash::make($data[‘password’]), ]); $to_name = ‘Laravel Bootcamp’; $to_email = $data[’email’]; $body = []; $mailData = ..

Read more

Currently building a Laravel application which allows users to generate football (soccer) tournaments – mostly for 5-7 a side. When creating a tournament, the organiser chooses whether it’s a round-robin or knockouts tournament. They also define how many pitches are available (e.g. 1, 2, 3), how long each match is in minutes and also how ..

Read more

I got this error message after I made Jobs to send an email "in SendEmail.php line 3" <?php ​ namespace AppJobs; use IlluminateBusQueueable; use IlluminateContractsQueueShouldQueue; use IlluminateFoundationBusDispatchable; use IlluminateQueueInteractsWithQueue; use IlluminateQueueSerializesModels; use AppMailResetPassword as Reset; use Mail; ​ class SendEmail implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; protected $reset; /** * Create a new ..

Read more

I need to change the div’s class name based on if condition below it. i have tried as <div class="<?php echo $class_name; ?>"> I want the class name to be "class name 1" or "class name 2" based on a if condition like if submitted and correct answer are same, i want the class name ..

Read more