├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── README.md ├── app ├── Http │ └── Controllers │ │ ├── Controller.php │ │ ├── JobController.php │ │ ├── RegisteredUserController.php │ │ └── SessionController.php ├── Jobs │ └── TranslateJob.php ├── Mail │ └── JobPosted.php ├── Models │ ├── Employer.php │ ├── Job.php │ └── User.php ├── Policies │ └── JobPolicy.php ├── Providers │ └── AppServiceProvider.php └── View │ └── Components │ └── Layout.php ├── artisan ├── bootstrap ├── app.php ├── cache │ └── .gitignore └── providers.php ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── cache.php ├── database.php ├── filesystems.php ├── logging.php ├── mail.php ├── queue.php ├── services.php └── session.php ├── database ├── .gitignore ├── factories │ ├── EmployerFactory.php │ ├── JobFactory.php │ └── UserFactory.php ├── migrations │ ├── 0001_01_01_000000_create_users_table.php │ ├── 0001_01_01_000001_create_cache_table.php │ ├── 0001_01_01_000002_create_jobs_table.php │ ├── 2024_03_21_151800_create_job_listings_table.php │ └── 2024_03_25_144504_create_employers_table.php └── seeders │ ├── DatabaseSeeder.php │ └── JobSeeder.php ├── package-lock.json ├── package.json ├── phpunit.xml ├── postcss.config.js ├── public ├── .htaccess ├── favicon.ico ├── index.php └── robots.txt ├── resources ├── css │ └── app.css ├── js │ ├── app.js │ └── bootstrap.js └── views │ ├── auth │ ├── login.blade.php │ └── register.blade.php │ ├── components │ ├── button.blade.php │ ├── form-button.blade.php │ ├── form-error.blade.php │ ├── form-field.blade.php │ ├── form-input.blade.php │ ├── form-label.blade.php │ ├── layout.blade.php │ └── nav-link.blade.php │ ├── contact.blade.php │ ├── home.blade.php │ ├── jobs │ ├── create.blade.php │ ├── edit.blade.php │ ├── index.blade.php │ └── show.blade.php │ ├── mail │ └── job-posted.blade.php │ └── vendor │ └── pagination │ ├── bootstrap-4.blade.php │ ├── bootstrap-5.blade.php │ ├── default.blade.php │ ├── semantic-ui.blade.php │ ├── simple-bootstrap-4.blade.php │ ├── simple-bootstrap-5.blade.php │ ├── simple-default.blade.php │ ├── simple-tailwind.blade.php │ └── tailwind.blade.php ├── routes ├── console.php └── web.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tailwind.config.js ├── tests ├── Feature │ └── ExampleTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php └── vite.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_TIMEZONE=UTC 6 | APP_URL=http://localhost 7 | 8 | APP_LOCALE=en 9 | APP_FALLBACK_LOCALE=en 10 | APP_FAKER_LOCALE=en_US 11 | 12 | APP_MAINTENANCE_DRIVER=file 13 | APP_MAINTENANCE_STORE=database 14 | 15 | BCRYPT_ROUNDS=12 16 | 17 | LOG_CHANNEL=stack 18 | LOG_STACK=single 19 | LOG_DEPRECATIONS_CHANNEL=null 20 | LOG_LEVEL=debug 21 | 22 | DB_CONNECTION=sqlite 23 | # DB_HOST=127.0.0.1 24 | # DB_PORT=3306 25 | # DB_DATABASE=laravel 26 | # DB_USERNAME=root 27 | # DB_PASSWORD= 28 | 29 | SESSION_DRIVER=database 30 | SESSION_LIFETIME=120 31 | SESSION_ENCRYPT=false 32 | SESSION_PATH=/ 33 | SESSION_DOMAIN=null 34 | 35 | BROADCAST_CONNECTION=log 36 | FILESYSTEM_DISK=local 37 | QUEUE_CONNECTION=database 38 | 39 | CACHE_STORE=database 40 | CACHE_PREFIX= 41 | 42 | MEMCACHED_HOST=127.0.0.1 43 | 44 | REDIS_CLIENT=phpredis 45 | REDIS_HOST=127.0.0.1 46 | REDIS_PASSWORD=null 47 | REDIS_PORT=6379 48 | 49 | MAIL_MAILER=log 50 | MAIL_HOST=127.0.0.1 51 | MAIL_PORT=2525 52 | MAIL_USERNAME=null 53 | MAIL_PASSWORD=null 54 | MAIL_ENCRYPTION=null 55 | MAIL_FROM_ADDRESS="hello@example.com" 56 | MAIL_FROM_NAME="${APP_NAME}" 57 | 58 | AWS_ACCESS_KEY_ID= 59 | AWS_SECRET_ACCESS_KEY= 60 | AWS_DEFAULT_REGION=us-east-1 61 | AWS_BUCKET= 62 | AWS_USE_PATH_STYLE_ENDPOINT=false 63 | 64 | VITE_APP_NAME="${APP_NAME}" 65 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | 3 | *.blade.php diff=html 4 | *.css diff=css 5 | *.html diff=html 6 | *.md diff=markdown 7 | *.php diff=php 8 | 9 | /.github export-ignore 10 | CHANGELOG.md export-ignore 11 | .styleci.yml export-ignore 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.phpunit.cache 2 | /node_modules 3 | /public/build 4 | /public/hot 5 | /public/storage 6 | /storage/*.key 7 | storage/debugbar 8 | /vendor 9 | .env 10 | .env.backup 11 | .env.production 12 | .phpunit.result.cache 13 | Homestead.json 14 | Homestead.yaml 15 | auth.json 16 | npm-debug.log 17 | yarn-error.log 18 | /.fleet 19 | /.idea 20 | /.vscode 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | 9 | 10 | ## About Laravel 11 | 12 | Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: 13 | 14 | - [Simple, fast routing engine](https://laravel.com/docs/routing). 15 | - [Powerful dependency injection container](https://laravel.com/docs/container). 16 | - Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. 17 | - Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). 18 | - Database agnostic [schema migrations](https://laravel.com/docs/migrations). 19 | - [Robust background job processing](https://laravel.com/docs/queues). 20 | - [Real-time event broadcasting](https://laravel.com/docs/broadcasting). 21 | 22 | Laravel is accessible, powerful, and provides tools required for large, robust applications. 23 | 24 | ## Learning Laravel 25 | 26 | Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. 27 | 28 | You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch. 29 | 30 | If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library. 31 | 32 | ## Laravel Sponsors 33 | 34 | We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com). 35 | 36 | ### Premium Partners 37 | 38 | - **[Vehikl](https://vehikl.com/)** 39 | - **[Tighten Co.](https://tighten.co)** 40 | - **[WebReinvent](https://webreinvent.com/)** 41 | - **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)** 42 | - **[64 Robots](https://64robots.com)** 43 | - **[Curotec](https://www.curotec.com/services/technologies/laravel/)** 44 | - **[Cyber-Duck](https://cyber-duck.co.uk)** 45 | - **[DevSquad](https://devsquad.com/hire-laravel-developers)** 46 | - **[Jump24](https://jump24.co.uk)** 47 | - **[Redberry](https://redberry.international/laravel/)** 48 | - **[Active Logic](https://activelogic.com)** 49 | - **[byte5](https://byte5.de)** 50 | - **[OP.GG](https://op.gg)** 51 | 52 | ## Contributing 53 | 54 | Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). 55 | 56 | ## Code of Conduct 57 | 58 | In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). 59 | 60 | ## Security Vulnerabilities 61 | 62 | If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. 63 | 64 | ## License 65 | 66 | The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). 67 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | latest()->simplePaginate(3); 15 | 16 | return view('jobs.index', [ 17 | 'jobs' => $jobs 18 | ]); 19 | } 20 | 21 | public function create() 22 | { 23 | return view('jobs.create'); 24 | } 25 | 26 | public function show(Job $job) 27 | { 28 | return view('jobs.show', ['job' => $job]); 29 | } 30 | 31 | public function store() 32 | { 33 | request()->validate([ 34 | 'title' => ['required', 'min:3'], 35 | 'salary' => ['required'] 36 | ]); 37 | 38 | $job = Job::create([ 39 | 'title' => request('title'), 40 | 'salary' => request('salary'), 41 | 'employer_id' => 1 42 | ]); 43 | 44 | Mail::to($job->employer->user)->queue( 45 | new JobPosted($job) 46 | ); 47 | 48 | return redirect('/jobs'); 49 | } 50 | 51 | public function edit(Job $job) 52 | { 53 | return view('jobs.edit', ['job' => $job]); 54 | } 55 | 56 | public function update(Job $job) 57 | { 58 | Gate::authorize('edit-job', $job); 59 | 60 | request()->validate([ 61 | 'title' => ['required', 'min:3'], 62 | 'salary' => ['required'] 63 | ]); 64 | 65 | $job->update([ 66 | 'title' => request('title'), 67 | 'salary' => request('salary'), 68 | ]); 69 | 70 | return redirect('/jobs/' . $job->id); 71 | } 72 | 73 | public function destroy(Job $job) 74 | { 75 | Gate::authorize('edit-job', $job); 76 | 77 | $job->delete(); 78 | 79 | return redirect('/jobs'); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/Http/Controllers/RegisteredUserController.php: -------------------------------------------------------------------------------- 1 | validate([ 20 | 'first_name' => ['required'], 21 | 'last_name' => ['required'], 22 | 'email' => ['required', 'email'], 23 | 'password' => ['required', Password::min(6), 'confirmed'] 24 | ]); 25 | 26 | $user = User::create($attributes); 27 | 28 | Auth::login($user); 29 | 30 | return redirect('/jobs'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Controllers/SessionController.php: -------------------------------------------------------------------------------- 1 | validate([ 18 | 'email' => ['required', 'email'], 19 | 'password' => ['required'] 20 | ]); 21 | 22 | if (! Auth::attempt($attributes)) { 23 | throw ValidationException::withMessages([ 24 | 'email' => 'Sorry, those credentials do not match.' 25 | ]); 26 | } 27 | 28 | request()->session()->regenerate(); 29 | 30 | return redirect('/jobs'); 31 | } 32 | 33 | public function destroy() 34 | { 35 | Auth::logout(); 36 | 37 | return redirect('/'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Jobs/TranslateJob.php: -------------------------------------------------------------------------------- 1 | jobListing->title . ' to Spanish.'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Mail/JobPosted.php: -------------------------------------------------------------------------------- 1 | 50 | */ 51 | public function attachments(): array 52 | { 53 | return []; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/Models/Employer.php: -------------------------------------------------------------------------------- 1 | hasMany(Job::class); 16 | } 17 | 18 | public function user(): BelongsTo 19 | { 20 | return $this->belongsTo(User::class); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Models/Job.php: -------------------------------------------------------------------------------- 1 | belongsTo(Employer::class); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | protected $hidden = [ 22 | 'password', 23 | 'remember_token', 24 | ]; 25 | 26 | /** 27 | * Get the attributes that should be cast. 28 | * 29 | * @return array{{ $message }}
5 | @enderror 6 | -------------------------------------------------------------------------------- /resources/views/components/form-field.blade.php: -------------------------------------------------------------------------------- 1 |9 | This job pays {{ $job->salary }} per year. 10 |
11 | 12 | @can('edit', $job) 13 |
14 |
6 | Congrats! Your job is now live on our website. 7 |
8 | 9 |10 | View Your Job Listing 11 |
12 | -------------------------------------------------------------------------------- /resources/views/vendor/pagination/bootstrap-4.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 46 | @endif 47 | -------------------------------------------------------------------------------- /resources/views/vendor/pagination/bootstrap-5.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 88 | @endif 89 | -------------------------------------------------------------------------------- /resources/views/vendor/pagination/default.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 46 | @endif 47 | -------------------------------------------------------------------------------- /resources/views/vendor/pagination/semantic-ui.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 36 | @endif 37 | -------------------------------------------------------------------------------- /resources/views/vendor/pagination/simple-bootstrap-4.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 27 | @endif 28 | -------------------------------------------------------------------------------- /resources/views/vendor/pagination/simple-bootstrap-5.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 29 | @endif 30 | -------------------------------------------------------------------------------- /resources/views/vendor/pagination/simple-default.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 19 | @endif 20 | -------------------------------------------------------------------------------- /resources/views/vendor/pagination/simple-tailwind.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 25 | @endif 26 | -------------------------------------------------------------------------------- /resources/views/vendor/pagination/tailwind.blade.php: -------------------------------------------------------------------------------- 1 | @if ($paginator->hasPages()) 2 | 106 | @endif 107 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 8 | })->purpose('Display an inspiring quote')->hourly(); 9 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 24 | Route::get('/jobs/{job}', [JobController::class, 'show']); 25 | 26 | Route::get('/jobs/{job}/edit', [JobController::class, 'edit']) 27 | ->middleware('auth') 28 | ->can('edit', 'job'); 29 | 30 | Route::patch('/jobs/{job}', [JobController::class, 'update']); 31 | Route::delete('/jobs/{job}', [JobController::class, 'destroy']); 32 | 33 | // Auth 34 | Route::get('/register', [RegisteredUserController::class, 'create']); 35 | Route::post('/register', [RegisteredUserController::class, 'store']); 36 | 37 | Route::get('/login', [SessionController::class, 'create'])->name('login'); 38 | Route::post('/login', [SessionController::class, 'store']); 39 | Route::post('/logout', [SessionController::class, 'destroy']); 40 | 41 | 42 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | export default { 3 | content: [ 4 | "./resources/**/*.blade.php", 5 | "./resources/**/*.js", 6 | "./resources/**/*.vue", 7 | ], 8 | theme: { 9 | extend: { 10 | colors: { 11 | "laracasts": "rgb(50,138,241)" 12 | } 13 | }, 14 | }, 15 | plugins: [], 16 | } 17 | 18 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 16 | 17 | $response->assertStatus(200); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | 4 | export default defineConfig({ 5 | plugins: [ 6 | laravel({ 7 | input: ['resources/js/app.js'], 8 | refresh: true, 9 | }), 10 | ], 11 | }); 12 | --------------------------------------------------------------------------------