Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

crivion/laraboard-careers

79 stars
4 code files
View crivion/laraboard-careers on GitHub

app/Events/JobApplicationReceivedEvent.php

Open in GitHub
use App\Models\JobApplication;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
 
class JobApplicationReceivedEvent
{
use Dispatchable, InteractsWithSockets, SerializesModels;
 
public $application;
 
public function __construct(JobApplication $application)
{
$this->application = $application;
}
 
public function broadcastOn()
{
return new PrivateChannel('channel-name');
}
}

app/Listeners/JobApplicationListener.php

Open in GitHub
use App\Events\JobApplicationReceivedEvent;
use App\Notifications\JobApplicationReceivedNotification;
use Illuminate\Contracts\Queue\ShouldQueue;
 
class JobApplicationListener
{
public function __construct()
{
}
 
public function handle(JobApplicationReceivedEvent $event)
{
$user = $event->application->job->user;
 
$user->notify(new JobApplicationReceivedNotification($event->application));
}
}

app/Providers/EventServiceProvider.php

Open in GitHub
use App\Events\JobApplicationReceivedEvent;
use App\Listeners\JobApplicationListener;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
 
class EventServiceProvider extends ServiceProvider
{
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
JobApplicationReceivedEvent::class => [
JobApplicationListener::class,
],
];
// ...
}

app/Http/Controllers/Front/StoreJobApplicationController.php

Open in GitHub
use App\Events\JobApplicationReceivedEvent;
use App\Http\Controllers\Controller;
use App\Http\Requests\StoreJobApplicationRequest;
use App\Models\Job;
 
class StoreJobApplicationController extends Controller
{
public function store(StoreJobApplicationRequest $request, Job $job)
{
$validated = $request->validated();
 
$validated['resume'] = $request->file('resume')->store('resumes');
 
$validated['cover_letter'] = request('coverLetter');
 
$application = $job->applications()->create($validated);
 
event(new JobApplicationReceivedEvent($application));
 
return redirect()->route('jobApplicationReceived', ['job' => $job]);
}
// ...
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.