@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use Afrittella\BackProject\Http\Requests\RoleEdit; |
| 7 | 7 | use Afrittella\BackProject\Repositories\Permissions; |
| 8 | 8 | use Afrittella\BackProject\Repositories\Roles; |
| 9 | -use Illuminate\Http\Request; |
|
| 10 | 9 | use Prologue\Alerts\Facades\Alert; |
| 11 | 10 | |
| 12 | 11 | class RolesController extends Controller |
@@ -37,12 +37,12 @@ |
||
| 37 | 37 | |
| 38 | 38 | public function create(Permissions $permissions) |
| 39 | 39 | { |
| 40 | - return view('back-project::roles.create')->with('permissions', $permissions->all()); |
|
| 40 | + return view('back-project::roles.create')->with('permissions', $permissions->all()); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function store(RoleAdd $request, Roles $roles) |
| 44 | 44 | { |
| 45 | - $role= $roles->create($request->all()); |
|
| 45 | + $role = $roles->create($request->all()); |
|
| 46 | 46 | |
| 47 | 47 | Alert::add('success', trans('back-project::crud.model_created', ['model' => trans('back-project::roles.role')]))->flash(); |
| 48 | 48 | |
@@ -3,13 +3,11 @@ |
||
| 3 | 3 | namespace Afrittella\BackProject\Http\Controllers; |
| 4 | 4 | |
| 5 | 5 | use Afrittella\BackProject\Http\Requests\AccountStore; |
| 6 | -use Afrittella\BackProject\Http\Requests\AccountEdit; |
|
| 7 | 6 | use Afrittella\BackProject\Repositories\Users; |
| 8 | 7 | use Afrittella\BackProject\Repositories\Roles; |
| 9 | 8 | use Afrittella\BackProject\Http\Requests\UserAdd; |
| 10 | 9 | use Afrittella\BackProject\Http\Requests\UserEdit; |
| 11 | 10 | use Afrittella\BackProject\Events\UserRegistered as Registered; |
| 12 | -use Illuminate\Http\Request; |
|
| 13 | 11 | use Prologue\Alerts\Facades\Alert; |
| 14 | 12 | use Auth; |
| 15 | 13 | |
@@ -3,11 +3,8 @@ |
||
| 3 | 3 | namespace Afrittella\BackProject\Listeners; |
| 4 | 4 | |
| 5 | 5 | use Afrittella\BackProject\Events\UserRegistered; |
| 6 | -use Illuminate\Queue\InteractsWithQueue; |
|
| 7 | 6 | use Illuminate\Contracts\Queue\ShouldQueue; |
| 8 | - |
|
| 9 | 7 | use Afrittella\BackProject\Repositories\Users; |
| 10 | - |
|
| 11 | 8 | use Illuminate\Support\Facades\Log; |
| 12 | 9 | use Afrittella\BackProject\Notifications\RegistrationEmail; |
| 13 | 10 | |
@@ -32,12 +32,12 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | public function handle(UserRegistered $event) |
| 34 | 34 | { |
| 35 | - //try { |
|
| 35 | + //try { |
|
| 36 | 36 | $user = $this->users->findBy('id', $event->user_id); |
| 37 | 37 | $user->notify(new RegistrationEmail($user)); |
| 38 | - //} catch(\Exception $e) { |
|
| 38 | + //} catch(\Exception $e) { |
|
| 39 | 39 | //Log::error('lavoro fallito'); |
| 40 | - //} |
|
| 40 | + //} |
|
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | |
@@ -3,11 +3,7 @@ |
||
| 3 | 3 | namespace Afrittella\BackProject\Listeners; |
| 4 | 4 | |
| 5 | 5 | use Afrittella\BackProject\Events\UserRegistered; |
| 6 | -use Illuminate\Queue\InteractsWithQueue; |
|
| 7 | -use Illuminate\Contracts\Queue\ShouldQueue; |
|
| 8 | - |
|
| 9 | 6 | use Afrittella\BackProject\Repositories\Users; |
| 10 | - |
|
| 11 | 7 | use Illuminate\Support\Facades\Log; |
| 12 | 8 | use Afrittella\BackProject\Notifications\RegistrationEmail; |
| 13 | 9 | |
@@ -31,12 +31,12 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function handle(UserRegistered $event) |
| 33 | 33 | { |
| 34 | - //try { |
|
| 34 | + //try { |
|
| 35 | 35 | $user = $this->users->findBy('id', $event->user_id); |
| 36 | 36 | $user->notify(new RegistrationEmail($user)); |
| 37 | - //} catch(\Exception $e) { |
|
| 37 | + //} catch(\Exception $e) { |
|
| 38 | 38 | //Log::error('lavoro fallito'); |
| 39 | - //} |
|
| 39 | + //} |
|
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | * Get the notification's delivery channels. |
| 28 | 28 | * |
| 29 | 29 | * @param mixed $notifiable |
| 30 | - * @return array |
|
| 30 | + * @return string[] |
|
| 31 | 31 | */ |
| 32 | 32 | public function via($notifiable) |
| 33 | 33 | { |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Bus\Queueable; |
| 6 | 6 | use Illuminate\Notifications\Notification; |
| 7 | -use Illuminate\Contracts\Queue\ShouldQueue; |
|
| 8 | 7 | use Illuminate\Notifications\Messages\MailMessage; |
| 9 | 8 | |
| 10 | 9 | class RegistrationEmail extends Notification |
@@ -96,6 +96,9 @@ |
||
| 96 | 96 | return $this->model->findOrCreate($data); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | + /** |
|
| 100 | + * @param string $attribute |
|
| 101 | + */ |
|
| 99 | 102 | public function findBy($attribute, $value, $columns = array('*')) |
| 100 | 103 | { |
| 101 | 104 | $this->applyCriteria(); |
@@ -7,7 +7,6 @@ |
||
| 7 | 7 | use Afrittella\BackProject\Exceptions\NotSavedException; |
| 8 | 8 | use Afrittella\BackProject\Exceptions\RepositoryException; |
| 9 | 9 | use Afrittella\BackProject\Repositories\Criteria\Criteria; |
| 10 | -use Illuminate\Container\Container as App; |
|
| 11 | 10 | use Illuminate\Database\Eloquent\Model; |
| 12 | 11 | use Illuminate\Support\Collection; |
| 13 | 12 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | return $this->model->create($data); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function update(array $data, $id, $attribute="id") |
|
| 51 | + public function update(array $data, $id, $attribute = "id") |
|
| 52 | 52 | { |
| 53 | 53 | $model_data = $this->model->where($attribute, '=', $id)->first(); |
| 54 | 54 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | return $this; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function skipCriteria($status = true){ |
|
| 126 | + public function skipCriteria($status = true) { |
|
| 127 | 127 | $this->skipCriteria = $status; |
| 128 | 128 | return $this; |
| 129 | 129 | } |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | public function applyCriteria() { |
| 146 | - if($this->skipCriteria === true) |
|
| 146 | + if ($this->skipCriteria === true) |
|
| 147 | 147 | return $this; |
| 148 | 148 | |
| 149 | - foreach($this->getCriteria() as $criteria) { |
|
| 150 | - if($criteria instanceof Criteria) |
|
| 149 | + foreach ($this->getCriteria() as $criteria) { |
|
| 150 | + if ($criteria instanceof Criteria) |
|
| 151 | 151 | $this->model = $criteria->apply($this->model, $this); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -107,8 +107,9 @@ discard block |
||
| 107 | 107 | //$model = $this->app->make($this->model()); |
| 108 | 108 | $model = app()->make($this->model()); |
| 109 | 109 | |
| 110 | - if (!$model instanceof Model) |
|
| 111 | - throw new RepositoryException("Class {$this->model()} must be an instance of Illuminate\\Database\\Eloquent\\Model"); |
|
| 110 | + if (!$model instanceof Model) { |
|
| 111 | + throw new RepositoryException("Class {$this->model()} must be an instance of Illuminate\\Database\\Eloquent\\Model"); |
|
| 112 | + } |
|
| 112 | 113 | |
| 113 | 114 | return $this->model = $model; |
| 114 | 115 | } |
@@ -143,12 +144,14 @@ discard block |
||
| 143 | 144 | } |
| 144 | 145 | |
| 145 | 146 | public function applyCriteria() { |
| 146 | - if($this->skipCriteria === true) |
|
| 147 | - return $this; |
|
| 147 | + if($this->skipCriteria === true) { |
|
| 148 | + return $this; |
|
| 149 | + } |
|
| 148 | 150 | |
| 149 | 151 | foreach($this->getCriteria() as $criteria) { |
| 150 | - if($criteria instanceof Criteria) |
|
| 151 | - $this->model = $criteria->apply($this->model, $this); |
|
| 152 | + if($criteria instanceof Criteria) { |
|
| 153 | + $this->model = $criteria->apply($this->model, $this); |
|
| 154 | + } |
|
| 152 | 155 | } |
| 153 | 156 | |
| 154 | 157 | return $this; |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | namespace Afrittella\BackProject\Repositories\Criteria\Attachments; |
| 3 | 3 | |
| 4 | 4 | use Afrittella\BackProject\Repositories\Criteria\Criteria; |
| 5 | -use Afrittella\BackProject\Contracts\BaseRepository as Repository; |
|
| 5 | +use Afrittella\BackProject\Contracts\BaseRepository as Repository; |
|
| 6 | 6 | use Illuminate\Support\Facades\Auth; |
| 7 | 7 | |
| 8 | 8 | class ByUser extends Criteria { |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | namespace Afrittella\BackProject\Repositories\Criteria; |
| 3 | 3 | |
| 4 | 4 | use Afrittella\BackProject\Repositories\Criteria\Criteria; |
| 5 | -use Afrittella\BackProject\Contracts\BaseRepository as Repository; |
|
| 5 | +use Afrittella\BackProject\Contracts\BaseRepository as Repository; |
|
| 6 | 6 | use Illuminate\Support\Facades\Auth; |
| 7 | 7 | |
| 8 | 8 | class ByUser extends Criteria { |
@@ -26,6 +26,9 @@ |
||
| 26 | 26 | return $this->model->withDepth()->find($id, $columns); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | + /** |
|
| 30 | + * @param string $name |
|
| 31 | + */ |
|
| 29 | 32 | public function tree($name) |
| 30 | 33 | { |
| 31 | 34 | $root = $this->findBy('name', $name); |
@@ -1,8 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Afrittella\BackProject\Repositories; |
| 3 | 3 | |
| 4 | -use Afrittella\BackProject\Contracts\BaseRepository; |
|
| 5 | - |
|
| 6 | 4 | class Menus extends Base |
| 7 | 5 | { |
| 8 | 6 | function model() |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | $body = []; |
| 71 | 71 | |
| 72 | 72 | foreach ($data as $row): |
| 73 | - $actions =[ |
|
| 73 | + $actions = [ |
|
| 74 | 74 | 'edit' => ['url' => route('menus.edit', [$row->id])] |
| 75 | 75 | ]; |
| 76 | 76 | |