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=
Run current file=false
Working Directory=
[Project]
VersionControlSupport=kdevgit

View file

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

View file

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

View file

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

View file

@ -1,37 +1,18 @@
<?php
use Illuminate\Support\Facades\Route;
use App\Models\Job;
Route::get('/', function () {
return view('home', ['greeting'=>'Hello']);
});
Route::get('/jobs', function () {
$jobs = Job::orderBy('salary','desc')->paginate(5);
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]);
// });
@ -39,26 +20,15 @@ return [[
Route::get('/contact', function() {
return view('contact');
});
Route::get('/jobs/{id}', function($id) {
$jobs=[
[
'id'=>1,
'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]);
Route::get('/jobs/{id}', function ($id) {
$job = Job::find($id);
return view('job', ['job' => $job]);
});