@clat23 try this
$timezoneForm = \Camroncade\Timezone::selectForm($user->timezone, 'Set Time Zone', $formAttributes);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I was using Laravel 5.3 and all was fine with what I was doing. I recently decided to use Spark so that I can have billing integrated with my app, but it broke an Autoloaded Service Provider. Note: I installed a fresh new install of Spark as I know Spark cannot be added to an existing app.
So let's start with the outside service provider: https://github.com/camroncade/timezone
Here's my code:
composer.json
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"laravel/tinker": "~1.0",
"laravel/cashier": "~7.0",
"laravel/spark": "*@dev",
"camroncade/timezone": "0.1"
},
config/app.php
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
Laravel\Tinker\TinkerServiceProvider::class,
/*
* Application Service Providers...
*/
Laravel\Spark\Providers\SparkServiceProvider::class,
App\Providers\SparkServiceProvider::class,
Laravel\Cashier\CashierServiceProvider::class,
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
/*
* Outside Service Providers...
*/
Camroncade\Timezone\TimezoneServiceProvider::class,
Of course I did run 'composer update' in the terminal and received this confirmation:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 1 update, 0 removals
- Updating league/flysystem (1.0.33 => 1.0.34) Downloading: 100%
- Installing camroncade/timezone (0.1) Downloading: 100%
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
The compiled services file has been removed.
Here's my code that I'm trying to run that implements the outside service provider:
$user = DB::table('users')->where('id', Auth::user()->id)->first();
$formAttributes = array('class' => 'form-control', 'name' => 'timezone');
$timezoneForm = Timezone::selectForm($user->timezone, 'Set Time Zone', $formAttributes);
echo $timezoneForm;
I receive this error when the code above is ran:
ErrorException in f6fd7675b144e6b0466b63d9fb0082b5b039e7ca.php line 22: Undefined property: stdClass::$timezone (View: /home/vagrant/Code...
(error was truncated for privacy)
Please help!
@clat23 i did this in a route entry and ran it and it worked
Route::get('test', function(){
$timezone = new Camroncade\Timezone\Facades\Timezone();
return $timezone::selectForm();
});
so based on my quick test...
$timezoneForm = new Camroncade\Timezone\Facades\Timezone();
$timezoneForm = $timezoneForm::selectForm($user->timezone, 'Set Time Zone', $formAttributes);
echo $timezoneForm;
hope that works
Please or to participate in this conversation.