Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
anibalealvarezs committed Mar 16, 2021
1 parent c9fb066 commit 55e460f
Show file tree
Hide file tree
Showing 16 changed files with 296 additions and 243 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
],
```

#### 2. If ***NOT*** installed, let's requiere jetstream and install livewire
#### 2. If ***NOT*** installed, let's requiere jetstream and install inertia
```
composer require laravel/jetstream
php artisan jetstream:install livewire
php artisan jetstream:install inertia --teams
```

#### 3. Require the package
Expand Down Expand Up @@ -49,6 +49,7 @@ If not, install these seeds manually
```
php artisan db:seed --class="Anibalealvarezs\Projectbuilder\Database\Seeders\PbSpatieSeeder"
php artisan db:seed --class="Anibalealvarezs\Projectbuilder\Database\Seeders\PbUsersSeeder"
php artisan db:seed --class="Anibalealvarezs\Projectbuilder\Database\Seeders\PbTeamSeeder"
php artisan db:seed --class="Anibalealvarezs\Projectbuilder\Database\Seeders\PbLoggerSeeder"
php artisan db:seed --class="Anibalealvarezs\Projectbuilder\Database\Seeders\PbConfigSeeder"
```
Expand Down Expand Up @@ -85,4 +86,4 @@ php artisan optimize

### Developing Suite

Clone the <a href="https://github.com/anibalealvarezs/builderdev">BuilderDev repository</a> in order to continue this package developing
Clone the <a href="https://github.com/anibalealvarezs/builderdev">BuilderDev repository</a> in order to continue this package developing
18 changes: 11 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"homepage": "https://anibalalvarez.com",
"license": "MIT",
"version" : "1.0.17",
"version" : "1.1.0",
"type" : "package",
"authors": [
{
Expand All @@ -20,12 +20,16 @@
}
],
"require": {
"php" : "^7.3",
"laravel/framework": "^8.0",
"laravel/jetstream": "^1.6",
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"inertiajs/inertia-laravel": "^0.3.5",
"laravel/framework": "^8.12",
"laravel/jetstream": "^2.2",
"laravel/sanctum": "^2.6",
"laravel/tinker": "^2.0",
"livewire/livewire": "^2.0",
"laravel/tinker": "^2.5",
"tightenco/ziggy": "^1.0",
"spatie/laravel-permission": "^3.17",
"spatie/laravel-translatable": "^4.6"
},
Expand Down Expand Up @@ -53,4 +57,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
21 changes: 0 additions & 21 deletions src/Controllers/Calculator/PbCalculatorController.php

This file was deleted.

48 changes: 24 additions & 24 deletions src/Controllers/Permission/PbPermissionController.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php

namespace Anibalealvarezs\Projectbuilder\Controllers\Permission;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;

use Auth;
use DB;

//Importing laravel-permission models
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;

use Session;

class PbPermissionController extends Controller
{
public function __construct() {
// $this->middleware(['auth', 'isAdmin']); //isAdmin middleware lets only users with a //specific permission permission to access these resources
}
}
<?php

namespace Anibalealvarezs\Projectbuilder\Controllers\Permission;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;

use Auth;
use DB;

//Importing laravel-permission models
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;

use Session;

class PbPermissionController extends Controller
{
public function __construct() {
// $this->middleware(['auth', 'isAdmin']); //isAdmin middleware lets only users with a //specific permission permission to access these resources
}
}
48 changes: 24 additions & 24 deletions src/Controllers/Permission/PbRoleController.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php

namespace Anibalealvarezs\Projectbuilder\Controllers\Permission;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;

use Auth;
use DB;

//Importing laravel-permission models
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;

use Session;

class PbRoleController extends Controller
{
public function __construct() {
// $this->middleware(['auth', 'isAdmin']);//isAdmin middleware lets only users with a //specific permission permission to access these resources
}
}
<?php

namespace Anibalealvarezs\Projectbuilder\Controllers\Permission;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;

use Auth;
use DB;

//Importing laravel-permission models
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;

use Session;

class PbRoleController extends Controller
{
public function __construct() {
// $this->middleware(['auth', 'isAdmin']);//isAdmin middleware lets only users with a //specific permission permission to access these resources
}
}
49 changes: 34 additions & 15 deletions src/Controllers/User/PbUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
use Auth;
use DB;

//Importing laravel-permission models
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;

//Enables us to output flash messaging
use Session;

Expand All @@ -27,7 +23,10 @@ class PbUserController extends Controller
*/
public function index()
{
//
$users = PbUser::latest()->paginate(5);

return view('builder::modules.users.index', compact('users'))
->with('i', (request()->input('page', 1) - 1) * 5);
}

/**
Expand All @@ -37,7 +36,7 @@ public function index()
*/
public function create()
{
//
return view('builder::modules.users.create');
}

/**
Expand All @@ -48,7 +47,16 @@ public function create()
*/
public function store(Request $request)
{
//
$request->validate([
'name' => 'required',
'email' => 'required',
'password' => 'required'
]);

PbUser::create($request->all());

return redirect()->route('builder::modules.users.index')
->with('success', 'User created successfully.');
}

/**
Expand All @@ -57,9 +65,9 @@ public function store(Request $request)
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
public function show($user)
{
//
return view('builder::modules.users.show', compact('user'));
}

/**
Expand All @@ -68,9 +76,9 @@ public function show($id)
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
public function edit($user)
{
//
return view('builder::modules.users.edit', compact('user'));
}

/**
Expand All @@ -80,9 +88,17 @@ public function edit($id)
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
public function update(Request $request, $user)
{
//
$request->validate([
'name' => 'required',
'email' => 'required',
'password' => 'required'
]);
$user->update($request->all());

return redirect()->route('builder::modules.users.index')
->with('success', 'User updated successfully');
}

/**
Expand All @@ -91,8 +107,11 @@ public function update(Request $request, $id)
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
public function destroy($user)
{
//
$user->delete();

return redirect()->route('builder::modules.users.index')
->with('success', 'User deleted successfully');
}
}
6 changes: 3 additions & 3 deletions src/Database/Seeders/PbConfigSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Anibalealvarezs\Projectbuilder\Database\Seeders;

use Anibalealvarezs\Projectbuilder\Models\PbConfig;
use Anibalealvarezs\Projectbuilder\Models\PbConfig as Config;
use Illuminate\Database\Seeder;

class PbConfigSeeder extends Seeder
Expand All @@ -15,7 +15,7 @@ class PbConfigSeeder extends Seeder
public function run()
{
// Default Config
PbConfig::create(['key' => '_APP_NAME_', 'value' => 'Builder']);
PbConfig::create(['key' => '_FORCE_HTTPS_', 'value' => false]);
Config::create(['key' => '_APP_NAME_', 'value' => 'Builder']);
Config::create(['key' => '_FORCE_HTTPS_', 'value' => false]);
}
}
34 changes: 34 additions & 0 deletions src/Database/Seeders/PbTeamSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Anibalealvarezs\Projectbuilder\Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\Team;

//Enables us to output flash messaging
use Session;

class PbTeamSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// Super Admin
$team = new Team();
$team->name = 'SuperAdmin';
$team->personal_team = 1;
$team->user_id = 1;
$team->save();

// Admin
$team = new Team();
$team->name = 'Admin';
$team->personal_team = 1;
$team->user_id = 1;
$team->save();
}
}
11 changes: 7 additions & 4 deletions src/Database/Seeders/PbUsersSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Database\Seeder;
use Anibalealvarezs\Projectbuilder\Models\PbUser as User;
use Illuminate\Support\Facades\Config;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
use Illuminate\Support\Facades\Hash;
Expand All @@ -22,18 +23,20 @@ public function run()
{
// anibalealvarezs
$user = new User();
$user->password = Hash::make('NoEntiendo2321');
$user->password = Hash::make('NoEntiendo2321', Config::get('hashing.'.Config::get('hashing.driver')));
$user->email = '[email protected]';
$user->name = 'Aníbal Álvarez';
$user->current_team_id = 1;
$user->save();
// SuperAdmin
$user->assignRole('super-admin');

// client
$user = new User();
$user->password = Hash::make('Client321');
$user->email = 'client@client';
$user->name = 'Client';
$user->password = Hash::make('Client321', Config::get('hashing.'.Config::get('hashing.driver')));
$user->email = 'Admin@admin';
$user->name = 'Admin';
$user->current_team_id = 2;
$user->save();
// Admin
$user->assignRole('admin');
Expand Down
Loading

0 comments on commit 55e460f

Please sign in to comment.