A free open source IT asset/license management system
something something prebreak
akemidxbd98ee62e1ed
diff --git a/app/Http/Requests/UpdateSharedTemplateRequest.php b/app/Http/Requests/UpdateSharedTemplateRequest.phpnew file mode 100644index 0000000000..0f56941e81--- /dev/null+++ b/app/Http/Requests/UpdateSharedTemplateRequest.php@@ -0,0 +1,44 @@+<?php++namespace App\Http\Requests;++use App\Http\Requests\Traits\MayContainCustomFields;+use App\Models\ReportTemplate;+use App\Models\Setting;+use Illuminate\Support\Facades\Gate;+use Illuminate\Validation\Rule;++class UpdateSharedTemplateRequest extends CustomAssetReportRequest+{+ use MayContainCustomFields;+ /**+ * Determine if the user is authorized to make this request.+ *+ * @return bool+ */+ public function authorize()+ {+ return Gate::allows('view', $this->id); //wait, no we always have the ability to view, we need to restrict on the rules+ }++ /**+ * Get the validation rules that apply to the request.+ *+ * @return array+ */+ public function rules()+ {+ $setting = Setting::getSettings(); //probably don't need this++ $rules = array_merge(+ parent::rules(),+ (new ReportTemplate)->getRules(),+ [+ if ($this->created_by == auth()->id()) //so how do we apply this rule. is it allow or restrict?++ ],+ )++ return $rules;+ }+}diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.phpindex a7da7436bc..e8ab25d7b0 100644--- a/resources/views/reports/custom.blade.php+++ b/resources/views/reports/custom.blade.php@@ -646,15 +646,7 @@</div> <!-- /.box-body--><div class="box-footer text-right">- @if (request()->routeIs('report-templates.edit') && $template->created_by != auth()->id())- {{--but how do we make this copy. can only get here if we force type, but then do we let this happen or just not hide the edit/copy.- maybe make the edit button a COPY button if you aren't the creator. i might like this idea.- that way, we UP FRONT allow a copy to be made once something is shared with you, and then its yours to edit and fumble around with off the cuff--}}- <button type="submit" class="btn btn-primary">- <i class="fas fa-check icon-white" aria-hidden="true"></i>- {{ trans('general.save_copy') }}- </button>- @elseif(request()->routeIs('report-templates.edit'))+ @if(request()->routeIs('report-templates.edit'))<button type="submit" class="btn btn-success"><i class="fas fa-download icon-white" aria-hidden="true"></i>{{ trans('general.save') }}