Put back site_id middleware

This commit is contained in:
Deon George 2024-07-23 15:05:56 +10:00
parent c91a2fa8e5
commit 45794ff109
5 changed files with 15 additions and 21 deletions

View File

@ -244,6 +244,6 @@ class AdminController extends Controller
->with('success','Settings saved'); ->with('success','Settings saved');
} }
return view('theme.backend.adminlte.theme.backend.adminlte.a.setup'); return view('theme.backend.adminlte.a.setup');
} }
} }

View File

@ -6,7 +6,6 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\View; use Illuminate\Support\Facades\View;
use Closure;
use App\Models\Site; use App\Models\Site;
@ -19,11 +18,13 @@ use App\Models\Site;
class SetSite class SetSite
{ {
/** /**
* @param Request $request * Handle an incoming request.
* @param Closure $next *
* @param Request $request
* @param \Closure $next
* @return mixed * @return mixed
*/ */
public function handle(Request $request,Closure $next) public function handle(Request $request,\Closure $next): mixed
{ {
$so = new Site; $so = new Site;

View File

@ -6,9 +6,11 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Leenooks\Traits\CompositeKeys; use Leenooks\Traits\CompositeKeys;
use App\Traits\SiteID;
class SiteDetail extends Model class SiteDetail extends Model
{ {
use CompositeKeys; use CompositeKeys,SiteID;
protected $casts = [ protected $casts = [
'social' => 'array', 'social' => 'array',
@ -55,13 +57,6 @@ class SiteDetail extends Model
public $timestamps = FALSE; public $timestamps = FALSE;
/* RELATIONS */
public function site()
{
return $this->belongsTo(Site::class);
}
/* ATTRIBUTES */ /* ATTRIBUTES */
/** /**
@ -82,12 +77,11 @@ class SiteDetail extends Model
/** /**
* Set our value, casting it if required * Set our value, casting it if required
* *
* @param $key
* @param $value * @param $value
* @return string * @return void
* @throws \Exception * @throws \Exception
*/ */
public function setValueAttribute($value) public function setValueAttribute($value): void
{ {
// Check that the value can be set // Check that the value can be set
if (! $this->key) if (! $this->key)
@ -111,7 +105,7 @@ class SiteDetail extends Model
* @return mixed * @return mixed
* @throws \Exception * @throws \Exception
*/ */
public static function sample($key) public static function sample($key): mixed
{ {
return Arr::get(self::sampleData,$key); return Arr::get(self::sampleData,$key);
} }

View File

@ -14,6 +14,7 @@ use Leenooks\Traits\UserSwitch;
use App\Interfaces\IDs; use App\Interfaces\IDs;
use App\Notifications\ResetPassword as ResetPasswordNotification; use App\Notifications\ResetPassword as ResetPasswordNotification;
use App\Traits\SiteID;
/** /**
* Class User * Class User
@ -23,7 +24,7 @@ use App\Notifications\ResetPassword as ResetPasswordNotification;
*/ */
class User extends Authenticatable implements IDs class User extends Authenticatable implements IDs
{ {
use HasFactory,HasApiTokens,Notifiable,UserSwitch,ScopeActive; use HasFactory,HasApiTokens,Notifiable,UserSwitch,ScopeActive,SiteID;
private const CACHE_TIME = 3600; private const CACHE_TIME = 3600;

View File

@ -20,15 +20,13 @@ class ResetPassword extends ResetPasswordNotification implements ShouldQueue
*/ */
public function toMail($notifiable): MailMessage public function toMail($notifiable): MailMessage
{ {
$site = Site::findOrFail($notifiable->site_id);
if (static::$toMailCallback) { if (static::$toMailCallback) {
return call_user_func(static::$toMailCallback, $notifiable, $this->token); return call_user_func(static::$toMailCallback, $notifiable, $this->token);
} }
return (new MailMessage) return (new MailMessage)
->markdown('email.user.passwordreset',[ ->markdown('email.user.passwordreset',[
'site'=>$site, 'site'=>$notifiable->site,
'user'=>$notifiable, 'user'=>$notifiable,
'reset_link'=>route('password.reset',$this->token,true), 'reset_link'=>route('password.reset',$this->token,true),
]); ]);