Unifiedtransform
Unifiedtransform copied to clipboard
Is there any option to delete the teacher ?
Right now there is no option. Pull Request is welcome.
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 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 What about implementing Soft deletes for that?