Skip to content

Commit

Permalink
Additional changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ImRishabhRawat committed Jul 11, 2023
1 parent 65a3c31 commit 1fce134
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
15 changes: 6 additions & 9 deletions Modules/CodeTrek/Http/Controllers/SessionController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php

namespace Modules\CodeTrek\Http\Controllers;

Check failure on line 3 in Modules/CodeTrek/Http/Controllers/SessionController.php

View workflow job for this annotation

GitHub Actions / Larastan

Namespace declaration statement has to be the very first statement in the script on line 3

Expand Down Expand Up @@ -29,7 +29,6 @@ public function index(CodeTrekApplicant $codeTrekApplicant)
*/
public function create(CodeTrekApplicant $codeTrekApplicant)
{

}

/**
Expand All @@ -40,8 +39,6 @@ public function create(CodeTrekApplicant $codeTrekApplicant)
*/
public function store(SessionRequest $request, CodeTrekApplicant $codeTrekApplicant)
{


$hiddenValue = $request->input('applicant_id');
$codeTrekApplicant = CodeTrekApplicant::find($hiddenValue);

Expand Down Expand Up @@ -72,15 +69,13 @@ public function store(SessionRequest $request, CodeTrekApplicant $codeTrekApplic
*/
public function show(CodeTrekApplicant $codeTrekApplicant, int $applicant)
{

$codeTrekApplicant = CodeTrekApplicant::findOrFail($applicant);

$sessions= $codeTrekApplicant->sessions()
->orderBy('date', 'desc')
->get();

return view('codetrek::Sessions.index')->with(['codeTrekApplicant' => $codeTrekApplicant,'sessions' =>$sessions]);

}
/**
* Show the form for editing the specified resource.
Expand All @@ -100,9 +95,10 @@ public function edit(CodeTrekApplicant $codeTrekApplicant)
* @param int $id
* @return \Illuminate\Http\Response
*/


public function update(SessionRequest $request, int $id)
{

$hiddenValue = $request->input('applicant');

$topicName = $request->input('topic_name');
Expand Down Expand Up @@ -132,13 +128,14 @@ public function update(SessionRequest $request, int $id)
* @param int $id
* @return \Illuminate\Http\Response
*/


public function destroy($session_id, $applicant_id )
{

$session = Session::find($session_id);
$session->delete();

return redirect()->route('codetrek.session.show',$applicant_id)->with('success', 'Session deleted successfully.');

}
}
13 changes: 2 additions & 11 deletions Modules/CodeTrek/Routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,9 @@
Route::resource('session', 'SessionController')
->only(['index', 'edit', 'update', 'store'])
->names(['index' => 'codetrek.session.index', 'edit' => 'codetrek.session.edit', 'update' => 'codetrek.session.update', 'store' => 'codetrek.session.store']);

Route::get('/session', 'SessionController@index')->name('codetrek.session.index');
Route::get('/session/{applicant}', 'SessionController@show')->name('codetrek.session.show');
Route::put('sessions/{session}', 'SessionController@update')->name('codetrek.session.update');
Route::post('/session/{session_id}/{applicant_id}','SessionController@destroy')->name('codetrek.session.delete');









Route::post('/session/{session_id}/{applicant_id}','SessionController@destroy')->name('codetrek.session.delete');
});

0 comments on commit 1fce134

Please sign in to comment.