diff --git a/app/Form.php b/app/Form.php index e234d94..5118486 100644 --- a/app/Form.php +++ b/app/Form.php @@ -16,6 +16,6 @@ class Form extends Model public function vacancy() { - return $this->hasMany('App\Vacancy', 'vacancyFormID'); + return $this->hasMany('App\Vacancy'); } } diff --git a/app/Http/Controllers/ApplicationController.php b/app/Http/Controllers/ApplicationController.php index ccf225c..aecf4a9 100644 --- a/app/Http/Controllers/ApplicationController.php +++ b/app/Http/Controllers/ApplicationController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Vacancy; use Illuminate\Http\Request; class ApplicationController extends Controller @@ -36,4 +37,26 @@ class ApplicationController extends Controller { return view('dashboard.appmanagement.interview'); } + + public function renderApplicationForm(Request $request, $vacancySlug) + { + $vacancyWithForm = Vacancy::with('forms')->where('vacancySlug', $vacancySlug)->get(); + + if (!$vacancyWithForm->isEmpty()) + { + + return view('dashboard.application-rendering.apply') + ->with([ + + 'vacancy' => $vacancyWithForm->first(), + 'preprocessedForm' => json_decode($vacancyWithForm->first()->forms->formStructure, true) + + ]); + } + else + { + abort(404, 'We\'re ssssorry, but the application form you\'re looking for could not be found.'); + } + + } } diff --git a/app/Http/Controllers/VacancyController.php b/app/Http/Controllers/VacancyController.php index 919af13..cbd0d0b 100644 --- a/app/Http/Controllers/VacancyController.php +++ b/app/Http/Controllers/VacancyController.php @@ -6,6 +6,7 @@ use App\Form; use App\Http\Requests\VacancyRequest; use App\Vacancy; use Illuminate\Http\Request; +use Illuminate\Support\Str; class VacancyController extends Controller { @@ -28,6 +29,7 @@ class VacancyController extends Controller 'vacancyName' => $request->vacancyName, 'vacancyDescription' => $request->vacancyDescription, + 'vacancySlug' => Str::slug($request->vacancyName), 'permissionGroupName' => $request->permissionGroup, 'discordRoleID' => $request->discordRole, 'vacancyFormID' => $request->vacancyFormID, diff --git a/app/Vacancy.php b/app/Vacancy.php index 464bcf9..8f4995d 100644 --- a/app/Vacancy.php +++ b/app/Vacancy.php @@ -16,13 +16,14 @@ class Vacancy extends Model 'discordRoleID', 'vacancyFormID', 'vacancyCount', - 'vacancyStatus' + 'vacancyStatus', + 'vacancySlug' ]; public function forms() { - return $this->belongsTo('App\Form'); + return $this->belongsTo('App\Form', 'vacancyFormID', 'id'); } public function open() diff --git a/database/migrations/2020_05_08_024654_add_slug_to_vacancy.php b/database/migrations/2020_05_08_024654_add_slug_to_vacancy.php new file mode 100644 index 0000000..5daa2c6 --- /dev/null +++ b/database/migrations/2020_05_08_024654_add_slug_to_vacancy.php @@ -0,0 +1,32 @@ +string('vacancySlug')->after('vacancyDescription'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('vacancies', function (Blueprint $table) { + $table->dropColumn('vacancySlug'); + }); + } +} diff --git a/resources/views/breadcrumbs/app.blade.php b/resources/views/breadcrumbs/app.blade.php index 9fcf391..b9cf000 100644 --- a/resources/views/breadcrumbs/app.blade.php +++ b/resources/views/breadcrumbs/app.blade.php @@ -1,99 +1,7 @@ - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Here, you can apply for open staff member positions, view your application status, and manage your profile.
-Sign up with Twitch or Email to continue.
-Here, you can apply for open staff member positions, view your application status, and manage your profile.
+Sign up with Twitch or Email to continue.
+You are applying for: {{$vacancy->vacancyName}}
+ +We're glad you've decided to apply. Generally, applications take 48 hours to be processed and reviewed. Depending on the circumstances and the volume of applications, you may receive an answer in a shorter time.
+Please fill out the form below. Keep all answers concise and complete. Please keep in mind that the age requirement is at least 18 years old.
+Asking about your application will result in instant denial. Everything you need to know is here.
+ +There is {{$position->vacancyCount}} open position!
+ @else +There are {{$position->vacancyCount}} open positions!
+ @endif