Git Product home page Git Product logo

Comments (11)

andrewdrake avatar andrewdrake commented on June 5, 2024 1

I'll take a look, yes it's Laravel 6. Might be an issue with PHP 7.4, I'll do some testing

from laravel-crm.

andrewdrake avatar andrewdrake commented on June 5, 2024 1

Ah ok, this is an interesting use case. The school management project has permissions tables already, which will conflict with the Spatie permissions package I have implemented. There is a way around this. Let me make some updates and run a few tests.

from laravel-crm.

andrewdrake avatar andrewdrake commented on June 5, 2024

Looks like conflict with the laravel-auditing package I set up for audit logging. What version of Laravel are you using?

from laravel-crm.

dharmikvyas avatar dharmikvyas commented on June 5, 2024

I am using this project.
https://github.com/hrshadhin/school-management-system.
I think it's 6.

from laravel-crm.

andrewdrake avatar andrewdrake commented on June 5, 2024

I have just released some updates and with latest version managed to get the package to install via composer. Please note I haven't completed a full install on that school management system. It is a bit out of date itself, no released for 2 years. Try a full install yourself and let me know if it works ok. I am also working on a CLI installer for the CRM as it is a bit manual at the moment.

from laravel-crm.

dharmikvyas avatar dharmikvyas commented on June 5, 2024

Ok.

from laravel-crm.

dharmikvyas avatar dharmikvyas commented on June 5, 2024

I have gone through all the installation steps but while executing 6th migration step it gives me following error.


Migrating: 2022_09_03_182548_create_permission_tables

   Illuminate\Database\QueryException  : SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'permissions' already exists (SQL: create table `permissions` (`id` bigint unsigned not null auto_increment primary key, `name` varchar(255) not null, `guard_name` varchar(255) not null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8 collate 'utf8_unicode_ci')

  at /Applications/MAMP/htdocs/cloudschool1/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
    665|         // If an exception occurs when attempting to run a query, we'll format the error
    666|         // message to include the bindings with SQL, which will make this exception a
    667|         // lot more helpful to the developer instead of just the database's errors.
    668|         catch (Exception $e) {
  > 669|             throw new QueryException(
    670|                 $query, $this->prepareBindings($bindings), $e
    671|             );
    672|         }
    673| 

  Exception trace:

  1   PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'permissions' already exists")
      /Applications/MAMP/htdocs/cloudschool1/vendor/laravel/framework/src/Illuminate/Database/Connection.php:463

  2   PDOStatement::execute()
      /Applications/MAMP/htdocs/cloudschool1/vendor/laravel/framework/src/Illuminate/Database/Connection.php:463

  Please use the argument -v to see more details.

So I changed table name from database/XX_create_permission_tables.php to crm_permissions
So I am getting this error

ErrorException  : Undefined index: crm_permissions

 at /Applications/MAMP/htdocs/cloudschool1/database/migrations/2022_09_03_182548_create_permission_tables.php:28
   24|         if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
   25|             throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
   26|         }
   27| 
 > 28|         Schema::create($tableNames['crm_permissions'], function (Blueprint $table) {
   29|             $table->bigIncrements('id');
   30|             $table->string('name');       // For MySQL 8.0 use string('name', 125);
   31|             $table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
   32|             $table->timestamps();

 Exception trace:

 1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Undefined index: crm_permissions", "/Applications/MAMP/htdocs/cloudschool1/database/migrations/2022_09_03_182548_create_permission_tables.php", [])
     /Applications/MAMP/htdocs/cloudschool1/database/migrations/2022_09_03_182548_create_permission_tables.php:28

 2   CreatePermissionTables::up()
     /Applications/MAMP/htdocs/cloudschool1/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php:392

 Please use the argument -v to see more details.

from laravel-crm.

dharmikvyas avatar dharmikvyas commented on June 5, 2024

Hi, any update sir?
I would like to use in my school management system (to give it a wing to fly)
If I can do anything from my side to remove this error I would like to work on that please help.

from laravel-crm.

andrewdrake avatar andrewdrake commented on June 5, 2024

Can you try this:

  1. Add this to your env file

LARAVEL_CRM_PERMISSION_TABLE_PREFIX=crm_

  1. Replace the "permissions.php" file in the application config folder with this new version

https://github.com/venturedrake/laravel-crm/blob/master/config/permission.php

  1. Run the migrate command.

This should allow the Spatie package tables to use alternative table names so not as to conflict with the tables currently in the schools package.

from laravel-crm.

dharmikvyas avatar dharmikvyas commented on June 5, 2024

Hi,
Sorry couldn't get permission.php file from provided URL. Can you please send me again?
I am sorry for little late. :(

from laravel-crm.

andrewdrake avatar andrewdrake commented on June 5, 2024

Link should be https://github.com/venturedrake/laravel-crm/blob/master/config/permission.php

from laravel-crm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.