- Timestamp:
- 10/21/21 23:45:59 (3 years ago)
- Branches:
- develop, master
- Children:
- 4b7e2d3
- Parents:
- 6b95845
- Location:
- database
- Files:
-
- 4 added
- 1 deleted
- 8 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
database/factories/DepartmentFactory.php
r6b95845 rc6b84df 24 24 public function definition() 25 25 { 26 $location = $this->faker->unique()->numberBetween( '1', '9');27 Storage::disk(' local')->makeDirectory('Departments/' . $location);26 $location = $this->faker->unique()->numberBetween(1, 15); 27 Storage::disk('uploads')->makeDirectory('Departments/' . $location); 28 28 return [ 29 29 'name' => "Department" . $this->faker->unique()->firstName(), 30 30 'code' => $location, 31 'location' => Storage::disk('local')->path('') .'Departments' . DIRECTORY_SEPARATOR . $location,31 'location' => 'Departments' . DIRECTORY_SEPARATOR . $location, 32 32 'user_id' => $this->faker->numberBetween('1', '2'), 33 33 'created_at' => Carbon::now() -
database/factories/FolderFactory.php
r6b95845 rc6b84df 4 4 5 5 use App\Models\Department; 6 use App\Models\ Document;6 use App\Models\Folder; 7 7 use Carbon\Carbon; 8 8 use Illuminate\Database\Eloquent\Factories\Factory; 9 9 use Illuminate\Support\Facades\Storage; 10 10 11 class DocumentFactory extends Factory11 class FolderFactory extends Factory 12 12 { 13 13 /** … … 16 16 * @var string 17 17 */ 18 protected $model = Document::class;18 protected $model = Folder::class; 19 19 20 20 /** … … 26 26 { 27 27 28 $deptID = "5"; 28 $deptId = $this->faker->numberBetween('1', '15'); 29 $deptCode = Department::find($deptId)->code; 29 30 $name = $this->faker->unique()->firstName(); 30 Storage::disk('local')->makeDirectory('Departments' . DIRECTORY_SEPARATOR . $deptID . DIRECTORY_SEPARATOR . $name); 31 32 $location = 'Departments' . DIRECTORY_SEPARATOR . $deptCode . DIRECTORY_SEPARATOR . $name; 33 Storage::disk('uploads')->makeDirectory($location); 34 31 35 32 36 return [ 33 'arch_id' => $dept ID. "/" . $this->faker->unique()->randomNumber(),37 'arch_id' => $deptCode . "/" . $this->faker->unique()->randomNumber(), 34 38 'name' => $name, 35 'description' => $this->faker->realText(), 39 'note' => $this->faker->realText(), 40 'location' => $location, 36 41 'user_id' => $this->faker->numberBetween('1', '2'), 37 'department_id' => $deptI D,42 'department_id' => $deptId, 38 43 'is_important' => $this->faker->boolean, 39 44 'created_at' => $this->faker->dateTime() 40 45 ]; 41 42 46 } 43 47 } -
database/migrations/2021_09_27_171107_create_users_table.php
r6b95845 rc6b84df 20 20 $table->string('surname'); 21 21 $table->string('username')->unique(); 22 $table->string('password');23 22 $table->string('email')->unique(); 24 23 $table->string('phone_number')->unique(); … … 30 29 $table->boolean('is_confirmed')->default(false); 31 30 $table->boolean('is_forgot_password')->default(false); 31 $table->integer("created_by")->unsigned(); 32 32 $table->integer('security_code')->nullable(); 33 33 $table->string('verify_token')->nullable(); 34 $table-> integer("created_by")->unsigned();34 $table->string('password'); 35 35 $table->rememberToken(); 36 36 $table->timestamps(); -
database/migrations/2021_10_06_103305_create_folders_table.php
r6b95845 rc6b84df 5 5 use Illuminate\Support\Facades\Schema; 6 6 7 class Create DocumentsTable extends Migration7 class CreateFoldersTable extends Migration 8 8 { 9 9 /** … … 14 14 public function up() 15 15 { 16 Schema::create(' documents', function (Blueprint $table) {16 Schema::create('folders', function (Blueprint $table) { 17 17 $table->bigIncrements('id'); 18 18 $table->string("arch_id")->unique(); 19 19 $table->string("name"); 20 $table->text("description"); 20 $table->text("note")->nullable(); 21 $table->string("location"); 21 22 $table->integer("user_id")->unsigned(); 22 23 $table->integer("department_id")->unsigned(); 23 $table->boolean("is_important")->default( true);24 $table->boolean("is_important")->default(false); 24 25 $table->timestamps(); 25 26 … … 36 37 public function down() 37 38 { 38 Schema::dropIfExists(' documents');39 Schema::dropIfExists('folders'); 39 40 } 40 41 } -
database/migrations/2021_10_10_103309_create_files_table.php
r6b95845 rc6b84df 16 16 Schema::create('files', function (Blueprint $table) { 17 17 $table->bigIncrements('id'); 18 $table->bigInteger(' document_id')->unsigned();18 $table->bigInteger('folder_id')->unsigned(); 19 19 $table->string("name"); 20 20 $table->string("location"); 21 $table->foreign(" document_id")->references("id")->on("documents");21 $table->foreign("folder_id")->references("id")->on("folders"); 22 22 $table->timestamps(); 23 23 }); -
database/seeders/DatabaseSeeder.php
r6b95845 rc6b84df 19 19 $this->call(UsersTableSeeder::class); 20 20 $this->call(DepartmentsTableSeeder::class); 21 //$this->call(DocumentsTableSeeder::class); 21 $this->call(FileTypeSeeder::class); 22 $this->call(FoldersTableSeeder::class); 22 23 } 23 24 } -
database/seeders/DepartmentsTableSeeder.php
r6b95845 rc6b84df 16 16 public function run() 17 17 { 18 Department::factory()->count( 8)->create();18 Department::factory()->count(15)->create(); 19 19 } 20 20 } -
database/seeders/PermissionsTableSeeder.php
r6b95845 rc6b84df 20 20 ["name" => "manage_all_users"], // Access all users to manage 21 21 ["name" => "manage_all_departments"], // Access all departments to manage 22 ["name" => "manage_all_ documents"], // Access all documents to manage22 ["name" => "manage_all_folders"], // Access all folders to manage 23 23 ["name" => "view_all_departments"], // Access all departments to view 24 ["name" => "view_all_documents"], // Access all documents to view 25 ["name" => "edit_all_documents"], // Edit all documents 26 ["name" => "edit_document"], // Edit your document/s 27 ["name" => "delete_all_documents"], // Delete all document/s 28 ["name" => "delete_document"], // Delete your document/s 29 ["name" => "manage_file_types"], // Access all file_types to manage 24 ["name" => "view_all_folders"], // Access all folders to view 25 ["name" => "edit_all_folders"], // Edit all folders 26 ["name" => "edit_folder"], // Edit your folder/s 27 ["name" => "delete_all_folders"], // Delete all folder/s 28 ["name" => "delete_folder"], // Delete your folder/s 29 ["name" => "manage_all_files"], // Access all files 30 ["name" => "manage_file_types"], // Access file types 30 31 ]); 31 32 } -
database/seeders/RolesPermissionsTableSeeder.php
r6b95845 rc6b84df 27 27 ["role_id" => 1, "permission_id" => 10], 28 28 ["role_id" => 1, "permission_id" => 11], 29 ["role_id" => 1, "permission_id" => 12], 29 30 30 31 // Referent -
database/seeders/RolesTableSeeder.php
r6b95845 rc6b84df 15 15 { 16 16 \DB::table('roles')->insert([ 17 ["name" => "Admin"], // Have access to all users(managing users), departments, documents etc18 ["name" => "Referent"], // Have access to manage and view all departments, documents etc19 ["name" => "Viewer"], // Have access to view all departments, documents etc17 ["name" => "Admin"], // Have access to all users(managing users), departments, folders etc 18 ["name" => "Referent"], // Have access to manage and view all departments, folders etc 19 ["name" => "Viewer"], // Have access to view all departments, folders etc 20 20 ]); 21 21 }
Note:
See TracChangeset
for help on using the changeset viewer.