Guest User

Untitled

a guest
Feb 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. Route::post('something/{xtype}/{xid}/execute/{yid}', 'MyController@execute');
  2.  
  3. public function execute($xtype, $xid, $yid)
  4. {
  5. // business logic
  6. return back();
  7. }
  8.  
  9. <form action="/something/{{ $something->xtype }}/{{ $something->xid }}/execute/{{ $others->yid }}" method="POST" id="y_{{ $others->yid }}">
  10. {!! csrf_field() !!}
  11. </form>
  12.  
  13. <a type="button" href="#" onClick="document.getElementById('y_{{ $others->yid }}').submit()">
  14.  
  15. public function handle($request, Closure $next)
  16. {
  17. if (Sentinel::check())
  18. {
  19. if (Sentinel::getUser()->roles()->first()->slug == 'admin')
  20. {
  21. return $next($request);
  22. }
  23. }
  24.  
  25. return redirect()->guest('/login')
  26. ->with(['error' => "You do not have the permission.."]);
  27. }
  28. }
Add Comment
Please, Sign In to add comment