Sync for migrating to git.fusil.uk (will mirror to this repo from now on)

This commit is contained in:
Xander 2025-03-18 09:32:44 +00:00
parent 22b8a1351f
commit a50d0ecf0e
5 changed files with 27 additions and 50 deletions

View file

@ -20,3 +20,6 @@ Output Filtering Mode=2
Remote Host= Remote Host=
Run current file=false Run current file=false
Working Directory= Working Directory=
[Project]
VersionControlSupport=kdevgit

View file

@ -13,7 +13,8 @@ return new class extends Migration
{ {
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name'); $table->string('first_name');
$table->string('last_name');
$table->string('email')->unique(); $table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable(); $table->timestamp('email_verified_at')->nullable();
$table->string('password'); $table->string('password');

View file

@ -16,7 +16,8 @@ class DatabaseSeeder extends Seeder
// User::factory(10)->create(); // User::factory(10)->create();
User::factory()->create([ User::factory()->create([
'name' => 'Test User', 'first_name' => 'Test',
'last_name' => 'Test',
'email' => 'test@example.com', 'email' => 'test@example.com',
]); ]);
} }

View file

@ -3,14 +3,16 @@
Jobs Listing Jobs Listing
</x-slot:heading> </x-slot:heading>
<h1>Jobs!</h1> <h1>Jobs!</h1>
<ul> <div id="joblist" class="space-y-4">
@foreach ($jobs as $job) @foreach ($jobs as $job)
<li>
<a href="/jobs/{{$job['id']}}" class="text-blue-500 hover:underline"> <a href="/jobs/{{$job['id']}}" class="text-blue-500 hover:underline">
<strong>{{$job['title']}}</strong>: Pays {{$job['salary']}} <strong>{{$job['title']}}</strong>: Pays {{$job['salary']}}
Per year Per year
</a> </a>
</li> <br>
</div>
@endforeach @endforeach
</ul> <div>
{{$jobs->links()}}
</x-layout> </x-layout>

View file

@ -1,37 +1,18 @@
<?php <?php
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use App\Models\Job;
Route::get('/', function () { Route::get('/', function () {
return view('home', ['greeting'=>'Hello']); return view('home', ['greeting'=>'Hello']);
}); });
Route::get('/jobs', function () { Route::get('/jobs', function () {
$jobs = Job::orderBy('salary','desc')->paginate(5);
return view('jobs', [ return view('jobs', [
'jobs'=> Job::all() 'jobs' => $jobs
]); ]);
}); });
class Job {
public static function all():array
{
return [[
'id'=>1,
'title'=>'Manager',
'salary'=>'$50,000'
],
[
'id'=>2,
'title'=>'Engineer',
'salary'=>'$40,000'
],
[
'id'=>3,
'title'=>'Assisstant',
'salary'=>'$30,000'
]
];
}
}
// return view('jobs', ['jobs' => $jobs]); // return view('jobs', ['jobs' => $jobs]);
// }); // });
@ -39,26 +20,15 @@ return [[
Route::get('/contact', function() { Route::get('/contact', function() {
return view('contact'); return view('contact');
}); });
Route::get('/jobs/{id}', function($id) { Route::get('/jobs/{id}', function ($id) {
$jobs=[ $job = Job::find($id);
[
'id'=>1, return view('job', ['job' => $job]);
'title'=>'Manager',
'salary'=>'$50,000'
],
[
'id'=>2,
'title'=>'Engineer',
'salary'=>'$40,000'
],
[
'id'=>3,
'title'=>'Assisstant',
'salary'=>'$30,000'
]
];
$job=\Illuminate\Support\Arr::first($jobs, function ($job) use ($id) {
return $job['id']==$id;
});
return view('job',['job'=>$job]);
}); });