Category : php-7.4

I have two tables: User and Organisation. User contains foreign key organisation_id referencing organisation. For viewing students, it shows error ‘Trying to get property ‘name’ of non object. Can anyone help me ? UserController public function view($id) { $record = User::find($id); return view(‘user.view’,compact(‘record’)); } user.php public function getOrg() { return $this->belongsTo(Organisation::class); } view.blade.php <tr> <th>Organisation</th> ..

Read more

The DataController does exist, and it is not in a folder within my controllers folder. my web.php file : <?php use IlluminateSupportFacadesRoute; use AppHttpControllersDataController; Route::get(‘/’, [DataController::class, ‘index’]); Route::post(‘/’, [DataController::class, ‘store’])->name(‘store’); Route::get(‘qrcode/{id}’, [DataController::class, ‘generate’])->name(‘generate’); my DataController file : <?php namespace AppHttpControllers; use IlluminateHttpRequest; use SimpleSoftwareIOQrCodeFacadesQrCode; use AppModelsData; class GenerateController extends Controller { public function index(){ $data ..

Read more

I am doing below code in Laravel 5.5 with mpdf 8.0 $mpdf = new MpdfMpdf(); $mpdf->WriteHTML(‘Hello World’); $mpdf->Output("test","I"); It outputs gibberish/garbage values, seemingly showing pdf file in raw form. Some findings If I use $mpdf->Output($reportPath, ‘F’); (saving it to file) and the opening that. It opens the file as expected. If I place die(); after ..

Read more

My project before it was in ‘nginx server’, now I downloaded and hosted to cpanel server. When I opened website in home page it shows error ‘This page isn’t working at the moment’ and in storage error logs shows [2021-10-16 06:45:37] production.ERROR: SQLSTATE[HY000] [1045] Access denied for user ‘cloudhost_ubcmlr’@’localhost’ (using password: YES) {"exception":"[object] (DoctrineDBALDriverPDOException(code: 1045): ..

Read more

I have a code block to return as a json as follow; $data = $this->regionRepository->getDistrictsByGivenTravelTag();//returns an array foreach ($data as $city){ $city["is_fav"] = false; if(auth()->user()){ /** city */ $fav_cities = auth()->user()->favoriteCities->pluck("id"); if(in_array($city["city_id"],$fav_cities->toArray())){ $city["is_fav"] = true; } } } dd($data); This code block shows it without "is_fave". But I want to add "is_fav" key. Therefore, I ..

Read more

I’m beginner in Laravel and when I’m trying to use Controller I’m getting this error IlluminateContractsContainerBindingResolutionException Target class [PostsController] does not exist. http://127.0.0.1:8000/posts routes directory contain web.php to route and there I’m using Route::get(‘/posts’, ‘[email protected]’); to redirect to the class PostsController <?php namespace AppHttpControllers; use IlluminateHttpRequest; class PostsController extends Controller { public function index() { ..

Read more

We are noticing a weird issue in Laravel 8 with PHP 7.4 version. When we save data to the Mysql db, it is storing garbage value. An example data: $product = Product::create([ ‘product_id’ => 6791044858042, ‘inventory_id’ => 42309695242426 ]); The same is happening using $product = new Product(); The value in the DB is "product_id":"701563066","inventory_id":"-27590470" ..

Read more

I’m building a semi-polymorphic/recursive tool to define products for a given website. I am breaking the product down into Components (features or options with sub-features and options), OptionLists (lists of options) and option items broken into simple Options (key/value/label/description) and ComponentOptions (options that add more features and options). To handle writing these configurations into a ..

Read more

Context I just finished developing an internal business application using Laravel/Jetstream with Inertia which uses a Model Broadcaster with Ably integrated for desktop notifications. Everything was working perfectly locally so I pushed live this afternoon. I have everything migrated and what appears to be setup properly, with https working. The server is a LEMP droplet ..

Read more

I have been trying to upload a csv file through backend dashboard of my laravel site, but it’s throwing an error , 504 gateway Timeout nginx . (This works perfectly in staging) While looking for the solution, I have updated the following parameters. In php.ini —> post_max_size upload_max_filesize max_execution_time max_input_time In nginx config —> fastcgi_read_timeout ..

Read more

I have a laravel query form using {!! Form::open([‘method’ => ‘GET’]) !!} with different query fields. For example, I have fields like name category price The user fills out the fields as required, however, even if a field is left ”blank” (null) the query parameter appears in the URL e.g sitename.com/products?name=’test’&category=&price= I was wondering if ..

Read more

My small problem is that Laravel does not trigger the update function if I click on my safe button on the edit page. The only thing that happens after clicking save is that the page is reloaded. Here is my small snippet for the code: edit.blade snippet: <form method="POST" action="{{ route(‘t_update’, $transport->id) }}" enctype="multipart/form-data"> @csrf ..

Read more

As the title says, it just stopped working out of sudden. I have a custom guard: config.auth.php ‘guards’ => [ ‘admin’ => [ ‘driver’ => ‘session’, ‘provider’ => ‘admins’, ], ….. ‘providers’ => [ ‘admins’ => [ ‘driver’ => ‘eloquent’, ‘model’ => AppAdmin::class, ], The user (or shall I say admin?) gets authenticated through login ..

Read more

[2021-04-13 17:57:01] production.ERROR: Invalid argument supplied for foreach() {"exception":"[object] (ErrorException(code: 0): Invalid argument supplied for foreach() at /home/nkcpanel/public_html/vendor/symfony/console/Input/ArgvInput.php:243) [stacktrace] #0 /home/nkcpanel/public_html/vendor/symfony/console/Input/ArgvInput.php(243): IlluminateFoundationBootstrapHandleExceptions->handleError(2, ‘Invalid argumen…’, ‘/home/nkcpanel/…’, 243, Array) #1 /home/nkcpanel/public_html/vendor/symfony/console/Application.php(960): SymfonyComponentConsoleInputArgvInput->getFirstArgument() #2 /home/nkcpanel/public_html/vendor/laravel/framework/src/Illuminate/Console/Application.php(84): SymfonyComponentConsoleApplication->getCommandName(Object(SymfonyComponentConsoleInputArgvInput)) #3 /home/nkcpanel/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): IlluminateConsoleApplication->run(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput)) #4 /home/nkcpanel/public_html/artisan(36): IlluminateFoundationConsoleKernel->handle(Object(SymfonyComponentConsoleInputArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput)) #5 {main} "} Sourc..

Read more