Server-side "is it christmas"
This commit is contained in:
		
					parent
					
						
							
								3e97458ee2
							
						
					
				
			
			
				commit
				
					
						0a50c93d3a
					
				
			
		
					 3 changed files with 21 additions and 26 deletions
				
			
		|  | @ -3,24 +3,32 @@ | |||
| namespace App\View\Components; | ||||
| 
 | ||||
| use Closure; | ||||
| use DateTime; | ||||
| use Illuminate\Contracts\View\View; | ||||
| use Illuminate\View\Component; | ||||
| 
 | ||||
| class Layout extends Component | ||||
| { | ||||
| class Layout extends Component { | ||||
|     /** | ||||
|      * Create a new component instance. | ||||
|      */ | ||||
|     public function __construct() | ||||
|     { | ||||
|         //
 | ||||
|     } | ||||
|     public function __construct() {} | ||||
| 
 | ||||
|     /** | ||||
|      * Get the view / contents that represent the component. | ||||
|      */ | ||||
|     public function render(): View|Closure|string | ||||
|     { | ||||
|         return view('components.layout'); | ||||
|     public function render(): View|Closure|string { | ||||
|         return view('components.layout', [ | ||||
|             'isChristmas' => $this->isItChristmas() | ||||
|         ]); | ||||
|     } | ||||
| 
 | ||||
|     public function isItChristmas() : bool { | ||||
|         $currentDate = new DateTime(); | ||||
|         $currentYear = intval($currentDate->format('Y')); | ||||
| 
 | ||||
|         $startDate = new DateTime("$currentYear-11-10"); | ||||
|         $endDate = new DateTime(($currentYear + 1) . "-01-01"); | ||||
| 
 | ||||
|         return $currentDate >= $startDate && $currentDate < $endDate; | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -10,7 +10,8 @@ | |||
|     <link rel="stylesheet" href="{{ asset('/css/master.css') }}"/> | ||||
|     <link rel="icon" type="image/png" href="{{ asset('/favicon-32x32.png') }}" sizes="32x32"/> | ||||
|     <link rel="icon" type="image/png" href="{{ asset('/favicon-16x16.png') }}" sizes="16x16"/> | ||||
|     {!! (intval(date('n')) == 12) ? '<script src="/js/christmas/snowstorm.js"></script>' : '' !!} | ||||
|     @if ($isChristmas)<script src="{{ asset('/js/christmas/snowstorm.js') }}"></script>@endif | ||||
| 
 | ||||
| 
 | ||||
|     <!-- Page-specific --> | ||||
|     <meta property="og:title" content="wah! (dot moe) - {{ $title }}"> | ||||
|  | @ -36,6 +37,7 @@ | |||
|         <div id="footer"> | ||||
|             <div> | ||||
|                 <span> | ||||
|                     {{ $isChristmas === true ? "true" : "false" }} | ||||
|                     © floppydisk 2021-{{ date('Y') }}<br> | ||||
|                     v{{ config('app.version') }}, <a href="https://git.frzn.dev/fwoppydwisk/diskfloppy.me/releases/latest">Source</a><br> | ||||
|                     Served by {{ gethostname() }} | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
|     <br> | ||||
|     <p>Some quick facts about me:</p> | ||||
|     <ul> | ||||
|         <li>19 y/o, he/him, British</li> | ||||
|         <li>{{ $age }} y/o, he/him, British</li> | ||||
|         <li>Theatre Technician and "Web Developer"</li> | ||||
|         <li>Loves ETC desks, prefers Generics to LEDs for some reason</li> | ||||
|         <li>Spends way too much time on his computer</li> | ||||
|  | @ -27,19 +27,4 @@ | |||
|         <li><strong>Gaming</strong> - <a href="https://steamcommunity.com/id/fwoppydwisk/">Steam Profile</a> | ||||
|         </li> | ||||
|     </ul> | ||||
| 
 | ||||
| {{--    <div class="section">--}} | ||||
| {{--        <h2>Random Quote</h2>--}} | ||||
| {{--        <hr>--}} | ||||
| {{--        <x-toh-quote/>--}} | ||||
| {{--    </div>--}} | ||||
| {{--    <div class="section">--}} | ||||
| {{--        <h2>Contact</h2>--}} | ||||
| {{--        <hr>--}} | ||||
| {{--        <p>--}} | ||||
| {{--            <strong>E-mail:</strong> <a href="mailto:contact@diskfloppy.me">contact@diskfloppy.me</a><br>--}} | ||||
| {{--            <strong>Mastodon:</strong> <a rel="me" href="https://c.im/@floppydisk">@floppydisk@c.im</a><br>--}} | ||||
| {{--            <strong>Matrix:</strong> <a href="https://matrix.to/#/@floppydisk:arcticfoxes.net">@floppydisk:arcticfoxes.net</a>--}} | ||||
| {{--        </p>--}} | ||||
| {{--    </div>--}} | ||||
| </x-layout> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 floppydiskette
				floppydiskette