Closed mo2l closed 8 years ago
@mo2l I'll try to recreate the error.
@mo2l I wasn't able to reproduce the error. I followed all the steps you mentioned above but the vendor:publish
and laratrust:setup
commands ran without problems.
Are you sure that you have the service provider in your config/app.php
file?
@santigarcor thanks for your response. this is my config/app.php file
`<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
*/
'name' => 'Laravel',
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services your application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => env('APP_DEBUG', true),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Logging Configuration
|--------------------------------------------------------------------------
|
| Here you may configure the log settings for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Settings: "single", "daily", "syslog", "errorlog"
|
*/
'log' => env('APP_LOG', 'single'),
'log_level' => env('APP_LOG_LEVEL', 'debug'),
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'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...
*/
'Teepluss\Theme\ThemeServiceProvider',
Laratrust\LaratrustServiceProvider::class,
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Laratrust' => Laratrust\LaratrustFacade::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'Theme' => 'Teepluss\Theme\Facades\Theme',
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
],
];`
as far I am not completely blind i should have added the service provider unter the providers part and also have added the alias. If I have made a error there please feel free to tell me. I would b happy to know.
Edit:
This is the output of vendor:publish
:
Copied Directory [/vendor/laravel/framework/src/Illuminate/Notifications/resources/views] To [/resources/views/vendor/notifications] Copied Directory [/vendor/laravel/framework/src/Illuminate/Pagination/resources/views] To [/resources/views/vendor/pagination] Publishing complete for tag []!
And for laratrust:setup
I get:
[Symfony\Component\Console\Exception\CommandNotFoundException] There are no commands defined in the "laratrust" namespace.
Furthermore just trying the artisan command there is no namespace laratrust listed.
@mo2l I think i have an idea. Try putting both service providers after Application Service Provider
section and it should look like this:
...
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
/*
* Package Service Providers...
*/
'Teepluss\Theme\ThemeServiceProvider',
Laratrust\LaratrustServiceProvider::class,
@santigarcor tried it still same problem
just have tried following the instructions with a new project. there it worked so i will probably start from scratch. thank you for your help :)
php artisan laratrust:setup
is not working for me either....
I don't want to install new project and move everything from the old one...
There should be some simple fix for this problem... Anybody solved it?
It seems that there is no laratrust command available when you run
$ php artisan | grep laratrust
so there must be installation problem or something...
I did all the steps from the docs to install this this package...
@sasokovacic please provide the detail of your setup, laravel version, laratraust version. I tried to reproduce it once but i couldn't do it.
I have laratrust 4.0 and laravel 5.4.... I followed the installation guide here http://laratrust.readthedocs.io/en/4.0/installation.html.
$ composer require "santigarcor/laratrust:4.0.*"
then added Laratrust\LaratrustServiceProvider::class and 'Laratrust' => Laratrust\LaratrustFacade::class, to config/app.php both at the bottom of the prviders and aliases arrays.. then I ran
$ php artisan vendor:publish --tag="laratrust"
and added 'role' => \Laratrust\Middleware\LaratrustRole::class, 'permission' => \Laratrust\Middleware\LaratrustPermission::class, 'ability' => \Laratrust\Middleware\LaratrustAbility::class, to the app/Http/Kernel.php routeMiddleware array...
Did I missed something?
I don't think so.
Try running composer dump-autoload
. Or you can delete all the vendors directory and run composer update
o or composer install
and check if it works.
I tried everything... nothing changed...
when I run $ php artisan | grep laratrust
I get empty line...
I also changed php version from 7.1. to 7.0 (I'm using laradock), removed vendor and reinstall everything in case there is some wierd problem or something... still having problem...
somebody already mentioned laratrust:setup error but here it is again
[Symfony\Component\Console\Exception\CommandNotFoundException]
There are no commands defined in the "laratrust" namespace.
I can see the commands in the vendor/santigarcor/laratrust/src/commands folder... This is it's content:
AddLaratrustUserTraitUseCommand.php MakePermissionCommand.php MakeRoleCommand.php MakeSeederCommand.php MakeTeamCommand.php MigrationCommand.php SetupCommand.php SetupTeamsCommand.php stubs/ UpgradeCommand.php
do I open new issue or should we continue on this one? I realy need to solve this today or else I'll have to find another acl package...
Let's continue here. Do you know if the Laratrust service provider is loaded at all? Try printing something in boot
and register
methods if you haven't checked yet.
it's not loaded... I checked again the config/app.php... service provider is there and also alias...
You said you ran
$ php artisan vendor:publish --tag="laratrust"
Did it publish the assets successfully? Any chance you're using OPcache in PHP CLI?
I cannot reproduce this. I did:
laravel new test
cd test
composer require santigarcor/laratrust
Then I added the service provider in config/app.php
at the end of the providers
array and all Laratrust commands are visible
...
key
key:generate Set the application key
laratrust
laratrust:add-trait Add LaratrustUserTrait to App\User class
laratrust:migration Creates a migration following the Laratrust specifications.
laratrust:permission Create Permission model if it does not exist
laratrust:role Create Role model if it does not exist
laratrust:seeder Creates the seeder following the Laratrust specifications.
laratrust:setup Setup migration and models for Laratrust
laratrust:setup-teams Setup the teams feature in case it is not used
laratrust:team Create Team model if it does not exist
laratrust:upgrade Creates a migration to upgrade laratrust from version 3.2 to 4.0.
make
make:auth Scaffold basic login and registration views and routes
make:command Create a new Artisan command
...
Did you do something besides what I just listed?
no.. I did it exactly like you... I did publish config and it says
laradock@9271f6d771ef:/var/www$ php artisan vendor:publish --force --tag="laratrust" Publishing complete.
Also tried
laradock@9271f6d771ef:/var/www$ php artisan vendor:publish --provider="Laratrust\LaratrustServiceProvider" --force Publishing complete.
If you force publishing it should log publishing directory e.g.
laradock@9271f6d771ef:/var/www$ php artisan vendor:publish --provider="Barryvdh\Cors\ServiceProvider" --force Copied File [/vendor/barryvdh/laravel-cors/config/cors.php] To [/config/cors.php] Publishing complete.
This is not the case with your package.... So nothing is copied into the config folder
Are you using Laratrust 4.0.1 and Laravel 5.4.28?
For me it would be the easiest if you could publish a minimal Laravel project where you can see this error.
yes.. 4.0.1 and 5.4.28..
ok I will install new laravel instance and try
it's working in new instance of laravel.. I guess I'll have to move all the code... It's a little bit annoying but don't want to spend additional time for debugging... need to finish the project... thanks for your help... I hope I don't return to this issue when I move and install everything...
ok... really didn't want to move everything so I tried one more time and figured it out now... here is the solution in case anybody else is having the same problem.. I printed out \Config::get('app.providers') and laratrust provider wasn't listed there.. so I ran
$ php artisan config:clear
and it's working now...
I'm glad you found the solution. I'll add the hint to the docs.
great... thanks...
I fix this issue with this: use Laratrust\Models\LaratrustRole; instead of this: use Laratrust\LaratrustRole;
hopefully this "\Models" this will help you.
i have shift all the Model to the Models folder then changed in all the files like: App\Models\User but i am getting error which is no message please help me.
@narru Try updating your config/laratrust.php
file with the right namespaces for you new models. That would be the only thing related to Laratrust.
Hey,
I am trying to install laratrust and use it in a project.
What i have done is the following:
"require": { "php": ">=5.6.4", "laravel/framework": "5.3.*", "teepluss/theme": "dev-master", "santigarcor/laratrust": "3.0.*"
Provider:
` / * Package Service Providers... /
`
Aliases:
'Lang' => Illuminate\Support\Facades\Lang::class, 'Laratrust' => Laratrust\LaratrustFacade::class, 'Log' => Illuminate\Support\Facades\Log::class,
php artisan vendor:publish
which happened not to generate a laratrust.php in my config directoryphp artisan laratrust:setup
which wasn't execution with following error message:[Symfony\Component\Console\Exception\CommandNotFoundException] There are no commands defined in the "laratrust" namespace.
I have redone the whole installing part twice to check that I didn't read over something. Any ideas how to solve this?