i try to parse the data with get as it take the data from the user authenticated then bring them to another database
this is the controller side
namespace App\Http\Controllers;
use App\Models\Job;
use App\Models\User;
use App\Models\Applicant;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
public function apply(Job $job){
$job = Job::findorfail($job->id);
if(Auth::guest()){
return redirect()->route('login')->with('error','anda musti anggota');
}
else{
$apply= new Applicant([
'name'=> $job->name,
'email'=> Auth::user()->email,
'job_id'=>$job->job_id,
'user_id'=>Auth::user()->user_id,
]);
$apply->save();
return redirect()->route('jobs.search')->with('success','anda berhasil mendaftar');
}
}
and here is the route
Route::get('/apply/{job}', [ApplicantController::class, 'apply'])->name('apply')->middleware('auth');