Comments (20)
What about fresh installs?
If someone has just installed the package, he will be required to do much steps:
- Config pre-requests Laravel settings
- Install Ticketit
- add Ticketit service provider to app config file
4. add dependents service providers - migrate
- Run the seeder
At this point he can go to the default url/tickets and use the new admin panel to adjust all settings, but if he uses another master template name, that requires three more steps:
- publish ticketit config file
- must adjust the master_template setting
- run the seeder again
@fusiondesign @fishmad , Do you have any thoughts about doing these:
- Do the migration automatically first time
- Ask At the first visit about the master_template name, if it differs from the default name in settings instead of giving error
- Run the seeder automatically at first time
from ticketit.
In answer to 1 .. We could do the migration automatically if the system found one is missing:
TicketitServiceProvider.php
public function boot()
{
// Package Migrations
$tables = [
'2015_07_22_115516_create_ticketit_tables',
'2015_07_22_123254_alter_users_table',
'2015_09_05_204742_create_jobs_table',
'2015_09_29_123456_add_completed_at_column_to_ticketit_table',
'2015_10_08_123457_create_settings_table'
];
// Application active migrations
$migrations = DB::select('select * from migrations');
$mig_counter = 0;
foreach ($migrations as $migration_arr) { // Count active package migrations
if (in_array($migration_arr->migration, $tables)) {
$mig_counter += 1;
}
}
if (count($tables) != $mig_counter) { // If a migration is missing, do the migrate
Artisan::call('migrate', array('--path' => 'vendor/kordy/ticketit/src/Migrations'));
}
from ticketit.
for the third point, we could run the seeder right after the automatic migration .. something like this:
// Package Migrations
$tables = [
'2015_07_22_115516_create_ticketit_tables',
'2015_07_22_123254_alter_users_table',
'2015_09_05_204742_create_jobs_table',
'2015_09_29_123456_add_completed_at_column_to_ticketit_table',
'2015_10_08_123457_create_settings_table'
];
// Application active migrations
$migrations = DB::select('select * from migrations');
$mig_counter = 0;
$run_seeds = true;
foreach ($migrations as $migration_arr) { // Count active package migrations
if (in_array($migration_arr->migration, $tables)) {
$mig_counter += 1;
}
}
if (count($tables) != $mig_counter) { // If a migration is missing, do the migrate
Artisan::call('migrate', array('--path' => 'vendor/kordy/ticketit/src/Migrations'));
}
// If ticketit_settings empty, run the seeder
$settings_table = DB::select('select * from ticketit_settings');
if (empty($settings_table)) {
Artisan::call('db:seed', array('--class' => 'Kordy\\Ticketit\\Seeds\\SettingsTableSeeder'));
}
from ticketit.
And we should fix the seeder class for the path of the config file
Seeds/SettingsTableSeeder.php
$config = [];
if (File::isFile('../config/ticketit.php')) {
$config = include '../config/ticketit.php';
File::move('../config/ticketit.php', '../config/ticketit.php.backup');
}
but that will make the seeding from command line fail to merge the previous user settings from 'config/ticketit.php' !!
from ticketit.
Found out how to resolve the seed problem .. actually two problems:
- seems that if we run seed from cli it will use a different path other than if you run it from provider
- because i put the automatic seed functionality in the provider boot, then when I run migrations or seed from cli, it will use the provider seed, so it will fail because provider seed is using a different path!!
The solution, because anyway if we run the seed using the provider or using the cli, either way, the provider seed will run, so lets make a check and choose the right path in each situation as follow:
in TicketitServiceProvider.php
// If ticketit_settings empty, run the seeder
$settings_table = DB::select('select * from ticketit_settings');
if (empty($settings_table)) {
$cli_path = 'config/ticketit.php'; // if seeder run from cli, use the cli path
$provider_path = '../config/ticketit.php'; // if seeder run from provider, use the provider path
$config_settings = [];
$settings_file_path = false;
if (File::isFile($cli_path)) {
$settings_file_path = $cli_path;
} elseif (File::isFile($provider_path)) {
$settings_file_path = $provider_path;
}
if ($settings_file_path) {
$config_settings = include $settings_file_path;
File::move($settings_file_path, $settings_file_path.'.backup');
}
$seeder = new SettingsTableSeeder();
$seeder->config = $config_settings;
$seeder->run();
}
Remove the file operations in Seeds/SettingsTableSeeder.php
class SettingsTableSeeder extends Seeder
{
public $config = [];
/**
* Seed the Plans table
*/
public function run()
{
$defaults = [];
$defaults = $this->cleanupAndMerge($this->getDefaults(), $this->config);
foreach ($defaults as $slug => $column) {
$setting = Setting::bySlug($slug);
from ticketit.
I will open a special PR for this issue for not making conflicts with other active PRs
from ticketit.
Note: You can try installing a fresh ticketit 0.2 using this command:
You might like to remove the dependents packages and a fresh database to see the latest effects mentioned in this issue
composer require kordy/ticketit:0.2.x-dev
Then just add the ticketit class to the config/app.php
Then the master_template setting in config/ticketit.php (only if it's different the master.blade.php)
from ticketit.
my master is located in a subdir /layouts so I'll see what happens.
from ticketit.
Do you have any thoughts about doing these:
- Do the migration automatically first time
- Ask At the first visit about the master_template name, if it differs from the default name in settings instead of giving error
- Run the seeder automatically at first time
I did 1 and 3 .. Still 2 requires interaction from the user as follow (only if it's different the resources/views/master.blade.php) :
- create ticketit config file at config/ticketit.php
- must adjust the master_template setting
- migrate:rollback and then run the seeder again
from ticketit.
I'm alive again. I gotta hit up a couple customer requests then I'll be doing a fresh install and giving thing a go. Very very nice work @thekordy
from ticketit.
I dropped my database, removed ticketit folders entirely
Commented // Kordy\Ticketit\TicketitServiceProvider::class, from config/app.php
ran - composer require kordy/ticketit:0.2.x-dev
php artisan migrate
php artisan db:seed
Uncommented Kordy\Ticketit\TicketitServiceProvider::class,
ran php artisan migrate --path=vendor/kordy/ticketit/src/Migrations
Everything installed and populated correctly, however I still had go into mysql directly and edit master_template from master to layouts/master.
I also had to open Models/Setting.php and still Uncommented Cache::forget('settings');
I would think the only way to truly capture to master file path is through CLI install process using a custom console command and take input from the user.
Alternatively you could try a custom file search during install to looks for any file with master in the filename and attempt to auto capture the view file path.
from ticketit.
Sorry I didn't get time to work on this last night! I've been up all night working on a client app for new features!! After some sleep today I'll get back to it :)
from ticketit.
Something I am working on it right now ;)
from ticketit.
Done :) ... Now a fresh install takes only 3 simple steps:
- composer require kordy/ticketit:0.2.x-dev (or just dump fresh db and clone the new commit)
- Add Kordy\Ticketit\TicketitServiceProvider::class, to config/app.php file
- Hit url/tickets-install
This just an opening, any modifications and improvements are very welcomed
from ticketit.
Sorry I didn't get time to work on this last night! I've been up all night working on a client app for new features!! After some sleep today I'll get back to it :)
@fusiondesign Please take all the time you need, No need for any rush. Only if you've got a free time more than you need and there is something you deeply like to code ;)
from ticketit.
I'm blown away!! @thekordy - Pulling things down and syncing now! Can't wait to try it
from ticketit.
It worked flawlessly. Excellent work @thekordy . One mention would be future updates to the Seeder: If we change a value or add new values to getDefaults() in SettingsTableSeeder.php -- Do you envision using the installer to run a simple reSeed as well or what do you imagine in this scenario?
I was considering changing line 26 in TicketitServiceProvider from "DB::table('ticketit_settings')->count() != 0" to something like:
... && DB::table('ticketit_settings')->count() != count(Setting::getDefaults())
I'm not sure how we'd like to approach this but I may have a better idea as I parse through all the awesome changes!!
from ticketit.
getDefaults() is not static obviously so that code wouldn't work without some changes, just getting some ideas going
from ticketit.
That would be better obviously
ticketit_migrations = File::files('../vendor/kordy/ticketit/src/Migrations/');
from ticketit.
Ooooohhh fancy! I like these ideas. :D
from ticketit.
Related Issues (20)
- Feature Request: Turn off reply-to email of agent
- Multiguard integration HOT 1
- How to localize ticketit HOT 1
- Email feature
- how to run ticket app on browser after installation , i executed php artisan ticketit:install and php artisan serve i am getting this site cant be reached on localhost:8000
- Graphics error HOT 2
- Error when install package HOT 3
- Webhook support
- kordy.info domain seems not reachable HOT 1
- composer require 'kordy/ticketit:0.*' HOT 2
- How can I enable the localization feature?
- Unable to complete Installation Process HOT 3
- Does the pacakge offer APIs? HOT 2
- Make sure that App\User exists HOT 1
- installation failed and showing below mentioned error
- Bootstrap 5
- E-Mail Function is not Working
- Use with Jetstream HOT 1
- laravel and php version
- Authenticated Remote Code Execution via Insecure Deserialization
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ticketit.