mirror of
https://github.com/anna-sara/vbytes_lan.git
synced 2026-03-16 16:25:41 +01:00
Version model
This commit is contained in:
parent
91e9f49d85
commit
0d5601505b
4 changed files with 191 additions and 0 deletions
114
app/Http/Controllers/VersionController.php
Normal file
114
app/Http/Controllers/VersionController.php
Normal file
|
|
@ -0,0 +1,114 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Version;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class VersionController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$ability = $request->ability;
|
||||||
|
|
||||||
|
if ($ability === "key_1") {
|
||||||
|
|
||||||
|
$latest_version_participants = Version::where('table', 'participants')->latest()->first();
|
||||||
|
$latest_version_volunteers = Version::where('table', 'volunteers')->latest()->first();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => true, 'participants' => $latest_version_participants ? $latest_version_participants->version : null , 'volunteers' => $latest_version_volunteers ? $latest_version_volunteers->version : null
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ability === "key_2") {
|
||||||
|
|
||||||
|
$latest_version_participants = Version::where('table', 'participants')->latest()->first();
|
||||||
|
$latest_version_volunteers = Version::where('table', 'volunteers')->latest()->first();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => true, 'participants' => $latest_version_participants ? $latest_version_participants->version : null , 'volunteers' => $latest_version_volunteers ? $latest_version_volunteers->version : null
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ability === "key_3") {
|
||||||
|
|
||||||
|
$latest_version_participants = Version::where('table', 'participants')->latest()->first();
|
||||||
|
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => true, 'participants' => $latest_version_participants ? $latest_version_participants->version : null
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ability === "key_4") {
|
||||||
|
|
||||||
|
|
||||||
|
$latest_version_participants = Version::where('table', 'participants')->latest()->first();
|
||||||
|
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => true, 'participants' => $latest_version_participants ? $latest_version_participants->version : null
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'success' => false, 'message' => 'Unauthorized'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
public function show(Version $version)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*/
|
||||||
|
public function edit(Version $version)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, Version $version)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy(Version $version)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
13
app/Models/Version.php
Normal file
13
app/Models/Version.php
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Version extends Model
|
||||||
|
{
|
||||||
|
protected $fillable = [
|
||||||
|
'table',
|
||||||
|
'version'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('versions', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('table')->nullable();
|
||||||
|
$table->integer('version')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('versions');
|
||||||
|
}
|
||||||
|
};
|
||||||
35
public/css/app/filament-gaze-stylesheet.css
Normal file
35
public/css/app/filament-gaze-stylesheet.css
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
/* We use this to prevent the gap/space creating ghost elements */
|
||||||
|
div:has(> .gaze-banner:not(.gaze-banner--has-content)) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fi-gaze-banner {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
padding: 1.5rem;
|
||||||
|
border: 1px solid var(--primary-500);
|
||||||
|
color: var(--primary-500);
|
||||||
|
background-color: var(--gray-100);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.fi.dark .fi-gaze-banner {
|
||||||
|
background-color: var(--color-gray-900);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fi-gaze-banner .icon-container {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fi-gaze-banner .text-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fi-gaze-banner .button-container {
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue