I have an admin-controller and i want to passe to it middle-ware to parameters to allow Super Admin to do admin stuff.
Here my controller:
class adminController extends Controller
{
public function __construct(){
$this->middleware('admin');
}
public function showGenerateCode(){
$code ="";
return view('create_code',compact('code'));
}
public function generateCode(Request $request){
$phone = $request['phone'];
$code = "";
$user = User::where('phone' ,'=',$phone)->first();
if($user){
$code = "Ce numero de telephone et deja associé a un utilisateur";
return view('create_code',compact('code'));
//dd($code);
}
else{
$code = "Code d'autorisation générer avec succé : ".substr($phone,1,3).rand(1000000,9999999);
return view('create_code',compact('code'));
}
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire