diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 8069e5d..ef628aa 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -244,6 +244,6 @@ class AdminController extends Controller ->with('success','Settings saved'); } - return view('theme.backend.adminlte.theme.backend.adminlte.a.setup'); + return view('theme.backend.adminlte.a.setup'); } } \ No newline at end of file diff --git a/app/Http/Middleware/SetSite.php b/app/Http/Middleware/SetSite.php index f724800..124a984 100644 --- a/app/Http/Middleware/SetSite.php +++ b/app/Http/Middleware/SetSite.php @@ -6,7 +6,6 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\View; -use Closure; use App\Models\Site; @@ -19,11 +18,13 @@ use App\Models\Site; class SetSite { /** - * @param Request $request - * @param Closure $next + * Handle an incoming request. + * + * @param Request $request + * @param \Closure $next * @return mixed */ - public function handle(Request $request,Closure $next) + public function handle(Request $request,\Closure $next): mixed { $so = new Site; diff --git a/app/Models/SiteDetail.php b/app/Models/SiteDetail.php index f7dc8c7..f1eceb0 100644 --- a/app/Models/SiteDetail.php +++ b/app/Models/SiteDetail.php @@ -6,9 +6,11 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Arr; use Leenooks\Traits\CompositeKeys; +use App\Traits\SiteID; + class SiteDetail extends Model { - use CompositeKeys; + use CompositeKeys,SiteID; protected $casts = [ 'social' => 'array', @@ -55,13 +57,6 @@ class SiteDetail extends Model public $timestamps = FALSE; - /* RELATIONS */ - - public function site() - { - return $this->belongsTo(Site::class); - } - /* ATTRIBUTES */ /** @@ -82,12 +77,11 @@ class SiteDetail extends Model /** * Set our value, casting it if required * - * @param $key * @param $value - * @return string + * @return void * @throws \Exception */ - public function setValueAttribute($value) + public function setValueAttribute($value): void { // Check that the value can be set if (! $this->key) @@ -111,7 +105,7 @@ class SiteDetail extends Model * @return mixed * @throws \Exception */ - public static function sample($key) + public static function sample($key): mixed { return Arr::get(self::sampleData,$key); } diff --git a/app/Models/User.php b/app/Models/User.php index fc8ef9b..32e4ff4 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -14,6 +14,7 @@ use Leenooks\Traits\UserSwitch; use App\Interfaces\IDs; use App\Notifications\ResetPassword as ResetPasswordNotification; +use App\Traits\SiteID; /** * Class User @@ -23,7 +24,7 @@ use App\Notifications\ResetPassword as ResetPasswordNotification; */ class User extends Authenticatable implements IDs { - use HasFactory,HasApiTokens,Notifiable,UserSwitch,ScopeActive; + use HasFactory,HasApiTokens,Notifiable,UserSwitch,ScopeActive,SiteID; private const CACHE_TIME = 3600; diff --git a/app/Notifications/ResetPassword.php b/app/Notifications/ResetPassword.php index 107efbf..ef297bc 100644 --- a/app/Notifications/ResetPassword.php +++ b/app/Notifications/ResetPassword.php @@ -20,15 +20,13 @@ class ResetPassword extends ResetPasswordNotification implements ShouldQueue */ public function toMail($notifiable): MailMessage { - $site = Site::findOrFail($notifiable->site_id); - if (static::$toMailCallback) { return call_user_func(static::$toMailCallback, $notifiable, $this->token); } return (new MailMessage) ->markdown('email.user.passwordreset',[ - 'site'=>$site, + 'site'=>$notifiable->site, 'user'=>$notifiable, 'reset_link'=>route('password.reset',$this->token,true), ]);