#### Category : php

so this is my route Route::group([‘prefix’ => ‘{locale}’],function(){ Route::get(‘/’,’[email protected]′)->name(‘post’)->middleware(‘setLocale’);}); for example, if I chose es in lang or any other language I want to go to Route::group([‘prefix’ => ‘{locale}’],function(){ Route::get(‘/’,’[email protected]′)->name(‘post’)->middleware(‘setLocale’);}); **so I can fetch data from another JSON file with another language ** Sourc..

I’ve been building and running a web app on my localhost. Everything was working fine after I carried out all the test to make sure everything was working fine. I finally decided to deploy the web app on heroku, where I wanted to add extra content on the landing page through by using the admin ..

What I have: I have table with a unique date column. id date 1 2021-09-01 2 2021-08-01 3 2021-07-01 4 2020-04-01 5 2020-03-01 6 2020-12-01 I pull data based on a month and year from a GET parameter. DB::table(‘budgets’)->whereMonth(‘created_at’, $request->get(‘month’))->whereYear(‘created_at’,$request->get(‘year’))->get()->first(); I do a check to see if a previous month is available in table ..

am using Laravel for some sass project where some deals are one step behind completion if just our rooms accepts ( alphabetic ) beside the actual numbers for example 101 – A101 ect. So room_number column data type was int so i converted it to a varchar no problem until now and everything is working ..

I am working with api with laravel/php and I need the data in following format. It would be great if you can help me or give some hint. if I do dd() $formData which is submitted from the form I get following array dd($formData); dd($formData) gives below result array:3 [▼ "fname" => "john" "lname" => .. Read more I never face this issue with creating laravel new project but today I face it unexpectedly for the first time ! I am using laravel 8. When I run laravel new project It shows me error saying Error Class ‘SymfonyComponentTranslationLoaderArrayLoader’ not found Here is full error message on pastebin https://pastebin.com/YqheTXe1 Sourc.. Read more I’m using Laravel and I’m facing a challenge trying to open excel sheets from my application. Is there a way in which i can open uploaded excel sheets with google sheets in the browser without having to download. Any assistance? Sourc.. Read more I have just installed composer to start learning Laravel but I have already encountered an annoying problem. When I run laravel new example-project on zsh, it seems that it has a big problem with Symfony: It is a lot of lines but it seems it is all related to Class SymfonyComponentTranslation* and the psr-4 autoloading .. Read more Got this error. I am not sure why. I guess some files got deleted maybe? I tried to run a composer update to fix it. Did not work. Then I deleted composer.lock and the vendor folder and ran composer install. Still the same. What would be the next step to try? Error Class "SymfonyComponentTranslationLoaderArrayLoader" not .. Read more I have a project on a Cpanel host and when I edit and upload some of my files it will delete all spaces in the file and the program will be got errors. for instance, it converts this code : @section(‘content’) <div class="container-fluid"> <div class="row"> </div> </div> to this code : @section(‘content’)<div class="container-fluid"><div class="row"></div></div> Source: .. Read more I want to redirect to my new post when I created a new post in Laravel But I get a ArgumentCountError Too few arguments to function AppHttpControllersArticlesController::store(), 1 passed in C:xampphtdocsforumvendorlaravelframeworksrcIlluminateRoutingController.php on line 54 and exactly 2 expected How can I fix it? Thanks web.php <?php Route::resource(‘articles’, ArticlesController::class); Route::get(‘/’, [ArticlesController::class, ‘index’])->name(‘root’); Route::resource(‘articles.comments’, CommentsController::class); ArticlesController.php public .. Read more I have a table of data with such data [{"datetime":"2021-09-28 03:00:00","hour":"03:00:00","value":0.5}, {"datetime":"2021-09-28 03:00:00","hour":"03:00:00","value":0.6},….] How do I group the data by "hour", and find the average of each hour? I’m looking for output: [{"hour":"01:00:00","avg":"0.55"},….] Sourc.. Read more I have an array with the ID of the services, and there is an array with the Product. They are related to each other as Many To Many. For expamle: Product [1, 2, 3] Service [2, 3, 6] Table product_id service_id 1 2 2 3 3 8 How can I check whether a product belongs .. Read more How to get heading from different table on export? class Kriteria_Export implements FromCollection, WithMapping, WithHeadings { public function collection() { return Alternatif::all(); } public function map($alternatif) :array { return [ $alternatif->nama_alt, ]; } public function headings(): array { return [ ‘Nama Alternatif’, ]; } } Tabel Alternatif Tabel Kriteria When Export I want like this .. Read more I just want to make funnel chart using php side by side like this for free but it look weird Look at here Sourc.. Read more I have two tables properties (id, name, address, created_at, updated_at) bookings (id, property_id, booking_date, total_amount, comission, created_at, updated_at) Property.php model has this relation public function bookings() { return$this->hasMany(‘AppModelsAirbnbBooking’,’property_id’,’id’); } I want to return an JSON response (or eloquent collection) like below [{ "property_id": 1, "address": "Property ABC", "bookings": { "2021": { "Jul": [ { ..

I’m using Laravel 5.8 and sometimes I get maximum execution time of 30 seconds exceeded laravel server error. Now in order to fix this error, I should place this set_time_limit(0); in the Controller method. But I need to add for whole website. If it was on localhost, I could simply go to PHP.ini file and ..

greetings fellow programmers, I’m making images from text, and I was ordered to make it support ligatures. is it possible to do so? I’m using imagettftext & imagettfbbox from GD library Sourc..

I’m using SPATIE laravel-activitylog I followed all the instructions but still it only log the Create function not update while using it on a Modal My Modal <?php namespace AppModels; use IlluminateDatabaseEloquentFactoriesHasFactory; use IlluminateDatabaseEloquentModel; use SpatieActivitylogTraitsLogsActivity; class Contact extends Model { use HasFactory, LogsActivity; protected $fillable = [ ‘comp_name’, ‘cont_name’, ‘cont_email’, ‘cont_number’, ‘created_by’, ‘updated_by’, ]; .. Read more I have problem with my php on mac, previously I had 2 php versions php7.3 and php7.2. for some reason I uninstalled them then reinstall php7.2. when I run brew link [email protected] and php -v I’m getting message dyld: Library not loaded: /usr/local/opt/tidy-html5/lib/libtidy.5.dylib Referenced from: /usr/local/opt/[email protected]/bin/php I already run command brew update brew upgrade php .. Read more Hi I am trying to insert multiple items into a laravel collection inside a php loop but only one is getting inserted (the last one), please help to insert all the values. This array$some_array = array(); has values like 1,2,3,4 The loop is like foreach ($some_array as$key => $value) {$final_lists = collect([ ..

I’m currently working with Laravel and came across a strange issue, though I could not find any answer to it. When I install Laravel (Jetstream) on Docker with NGINX (Latest), PHP-FPM (PHP 8) and MariaDB 10.5, everything works as expected and I can run all migrations. As soon as I switch to MariaDB 10.6 I ..

I am very new to PHP(Laravel) and got some project. This is the explanation: One device exists someplace and it gathers some data. My project needs to log in to the device and need to get data by JSON file. I used this code for that work: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "$url.0.json"); curl_setopt($ch, CURLOPT_USERPWD, ..