File tree Expand file tree Collapse file tree 9 files changed +358
-11
lines changed
Expand file tree Collapse file tree 9 files changed +358
-11
lines changed Original file line number Diff line number Diff line change 99 }
1010 ],
1111 "minimum-stability" : " stable" ,
12- "require" : {}
12+ "require" : {},
13+
14+ "autoload" : {
15+ "psr-4" : {
16+ "sachingk\\ kvpair" : " sachingk/kvpair"
17+ }
18+ },
19+
20+ "scripts" : {
21+ "post-install-cmd" : [
22+
23+
24+ ],
25+ "post-update-cmd" : [
26+
27+ ],
28+ "post-create-project-cmd" : [
29+
30+ ],
31+ "post-autoload-dump" : [
32+ " sachingk\\ kvpair\\ install::postPackageInstall"
33+ ]
34+
35+ }
1336}
Original file line number Diff line number Diff line change 88class kvpair extends Facade
99{
1010
11- protected static function getFacadeAccessor () { return 'kvpair ' ; }
11+ protected static function getFacadeAccessor () { return 'KVPair ' ; }
1212
1313}
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Created by PhpStorm.
4+ * User: saching.kulkarni
5+ * Date: 2/24/2017
6+ * Time: 9:43 PM
7+ */
8+
9+ namespace sachingk \kvpair ;
10+
11+ use Illuminate \Database \Eloquent \Model ;
12+
13+ class KVPairModel extends Model
14+ {
15+ public $ table = "kvpair " ;
16+
17+ public $ fillable = [
18+ "key " ,
19+ "value " ,
20+ "description " ,
21+ "group "
22+ ];
23+
24+
25+ public static $ rules = [
26+ "key " => "required " ,
27+ "value " => "required " ,
28+ "group " => "required "
29+ ];
30+ }
Original file line number Diff line number Diff line change @@ -13,11 +13,25 @@ class KVPairServiceProvider extends ServiceProvider
1313 */
1414 public function boot ()
1515 {
16+
17+
1618 $ this ->loadTranslationsFrom ( __DIR__ .'/Lang ' , 'kvpair ' );
1719
20+ $ this ->loadMigrationsFrom (__DIR__ .'/database/migration ' );
21+
1822 $ this ->publishes ([
1923 __DIR__ .'/Config/kvpair.php ' => config_path ('kvpair.php ' ),
2024 ], 'config ' );
25+
26+
27+ $ this ->publishes ([
28+ __DIR__ .'/database/migration ' => database_path ('migrations ' )
29+ ], 'migrations ' );
30+
31+
32+ $ this ->publishes ([
33+ __DIR__ .'/Lang ' => base_path ('resources/lang ' )
34+ ], 'lang ' );
2135 }
2236
2337 /**
@@ -32,10 +46,8 @@ public function register()
3246
3347 $ this ->mergeConfigFrom ( __DIR__ .'/Config/kvpair.php ' , 'kvpair ' );
3448
35-
36-
37- $ this ->app ->singleton ('kvpair ' , function ($ app ) {
38- return new kvpair ();
49+ $ this ->app ->singleton ('KVPair ' , function ($ app ) {
50+ return new KVPair ();
3951 });
4052
4153 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Illuminate \Support \Facades \Schema ;
4+ use Illuminate \Database \Schema \Blueprint ;
5+ use Illuminate \Database \Migrations \Migration ;
6+
7+ class InstallKVPair extends Migration
8+ {
9+ /**
10+ * Run the migrations.
11+ *
12+ * @return void
13+ */
14+ public function up ()
15+ {
16+ Schema::create ('kvpair ' , function (Blueprint $ table ) {
17+ $ table ->string ("key " )->unique ()->index ();
18+ $ table ->string ("value " );
19+ $ table ->longText ("description " );
20+ $ table ->string ("group " );
21+ $ table ->timestamps ();
22+ });
23+ }
24+
25+ /**
26+ * Reverse the migrations.
27+ *
28+ * @return void
29+ */
30+ public function down ()
31+ {
32+ Schema::dropIfExists ('kvpair ' );
33+ }
34+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Created by PhpStorm.
4+ * User: saching.kulkarni
5+ * Date: 2/24/2017
6+ * Time: 7:00 PM
7+ */
8+
9+ namespace sachingk \kvpair ;
10+
11+ class install
12+ {
13+
14+
15+ public static function postPackageInstall (){
16+ Artisan::call ("php artisan vendor:publish --tag=lang " );
17+ Artisan::call ("php artisan vendor:publish --tag=config " );
18+ Artisan::call ("php artisan vendor:publish --tag=migrations " );
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments