Unifiedtransform icon indicating copy to clipboard operation
Unifiedtransform copied to clipboard

Is there any option to delete the teacher ?

Open seAfnan opened this issue 5 years ago • 4 comments

seAfnan avatar Sep 27 '19 06:09 seAfnan

Right now there is no option. Pull Request is welcome.

changeweb avatar Sep 27 '19 20:09 changeweb

add a somewhat rustic but functional shape In routes: Route::get('delete-records','StudDeleteController@index'); Route::get('delete/{id}','StudDeleteController@destroy');

Inside controllers create one with this name "StudDeleteController and add the following code: <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use DB; use App\Http\Requests; use App\Http\Controllers\Controller; class StudDeleteController extends Controller { public function index(){ $users = DB::select('select * from users'); return view('stud_delete_view',['users'=>$users]); } public function destroy($id) { DB::delete('delete from users where id = ?',[$id]); echo "User deleted"; return back(); } }

Finally add the button in views/components/user-list.blade.php and add next code: <a href="/delete/{{ $user->id}}"> <button type="submit" style="margin: 5px;" class="btn btn btn-xs btn-danger">Eliminar</button></a> This code works for students and teachers, the record it is also removed from the database (destroy)

luisbonejo9807 avatar Jul 09 '20 23:07 luisbonejo9807

@luisbonejo9807 No teachers should be deleted because one can find course history related to the teacher. Better make the status of the user with role 'teacher' to '0' to hide.

changeweb avatar Jul 10 '20 03:07 changeweb

@changeweb What about implementing Soft deletes for that?

CirkaN avatar Nov 21 '20 03:11 CirkaN