Ejemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($card_id = false, $camp_id = false)
 {
     $data['tasks'] = Task::get_tasks($card_id, $camp_id);
     $data['createbtn'] = Permission::hasPermission('tasks.create');
     $data['editbtn'] = Permission::hasPermission('tasks.edit');
     $data['deletebtn'] = Permission::hasPermission('tasks.delete');
     return view('tasks.index', $data);
 }
Ejemplo n.º 2
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest() && $request->ajax()) {
         return response('Unauthorized.', 401);
     }
     /*
     |--------------------------------------------------------------------------
     | Admin auth filter
     |--------------------------------------------------------------------------
     | You need to give your routes a name before using this filter.
     | I assume you are using resource. so the route for the UsersController index method
     | will be admin.users.index then the filter will look for permission on users.view
     | You can provide your own rule by passing a argument to the filter
     |
     */
     $userRule = null;
     // no special route name passed, use the current name route
     if (is_null($userRule)) {
         $explode = explode('.', Route::currentRouteName());
         if (count($explode) < 3) {
             $userRule = Route::currentRouteName();
         } else {
             $userRule = $explode[1] . '.' . $explode[2];
         }
     }
     $userRule = str_replace("-", '.', $userRule);
     // no access to the request page and request page not the root admin page
     if (!Permission::hasPermission($userRule) && $userRule !== 'ruban.home') {
         $redirect['route'] = 'ruban.home';
         $redirect['with'] = 'danger';
         $redirect['message'] = trans('ruban.permissions.access_denied');
     } else {
         if (!Permission::hasPermission($userRule) && $userRule === 'ruban.home') {
             //can't see the admin home page go back to home site page
             $redirect['route'] = 'auth.logout';
             $redirect['with'] = 'danger';
             $redirect['message'] = trans('ruban.permissions.access_denied');
         }
     }
     if (isset($redirect['route'])) {
         return Redirect::route($redirect['route'])->with($redirect['with'], $redirect['message']);
     }
     return $next($request);
 }
Ejemplo n.º 3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['dispute'] = Dispute::findOrFail($id);
     $data['projects'] = Dispute::getlists(Project::get_payouts(2, 0));
     $data['cancelbtn'] = Permission::hasPermission('disputes.index');
     return view('disputes.edit', $data);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['permission'] = Permission::findOrFail($id);
     $data['cancelbtn'] = Permission::hasPermission('permissions.index');
     return view('permissions.edit', $data);
 }
Ejemplo n.º 5
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['group'] = $group = Group::find($id);
     if ($group) {
         $data['permissions'] = Permission::all();
         $data['userPermissions'] = Permission::formatpermission($group->permissions);
         $data['cancelbtn'] = Permission::hasPermission('groups.index');
         return view('groups.edit', $data);
     } else {
         Session::flash('danger', Lang::get('ruban.group.notfound'));
         return Redirect::route('ruban.groups.index');
     }
 }
Ejemplo n.º 6
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response*/
 public function edit($id)
 {
     $data['district'] = $district = District::find($id);
     if ($district) {
         $data['projects'] = Project::orderby('name', 'asc')->lists('name', 'id');
         $data['cancelbtn'] = Permission::hasPermission('districts.index');
         return view('districts.edit', $data);
     } else {
         Session::flash('danger', Lang::get('ruban.district.notfound'));
         return Redirect::route('ruban.districts.index');
     }
 }
Ejemplo n.º 7
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['card'] = $card = Card::find($id);
     if ($card) {
         $data['sectors'] = Sector::lists('name', 'id');
         $data['districts'] = District::groupby($this->district)->lists($this->district, 'id');
         $data['projects'] = Project::orderby('name', 'asc')->lists('name', 'id');
         $data['listbtn'] = Permission::hasPermission('cards.update');
         return view('cards.edit', $data);
     } else {
         Session::flash('danger', Lang::get('ruban.card.notfound'));
         return Redirect::route('ruban.cards.index');
     }
 }
Ejemplo n.º 8
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data['project'] = $project = Project::find($id);
     if ($project) {
         $data['sectors'] = Sector::lists('name', 'id');
         $data['states'] = State::lists('state', 'id');
         $data['districts'] = District::where('state_id', $data['project']->state_id)->lists('district', 'id');
         $data['taluks'] = Taluk::where('district_id', $data['project']->district_id)->lists('taluk', 'id');
         $data['cancelbtn'] = Permission::hasPermission('projects.index');
         return view('projects.edit', $data);
     } else {
         Session::flash($this->danger, Lang::get('ruban.project.notfound'));
         return Redirect::route('ruban.projects.index');
     }
 }
Ejemplo n.º 9
0
 /**
  * Update the profile
  *
  * @param  int  $id
  * @return Response
  */
 public function updateprofile($id)
 {
     $data['user'] = User::findOrFail($id);
     $data['sectors'] = Sector::lists('name', 'id');
     $data['districts'] = District::lists('district', 'id');
     $districtsselected = PartnerDistrict::get_districts_selected($id);
     $data['districtsselected'] = PartnerDistrict::format_selected($districtsselected);
     $data['cancelbtn'] = Permission::hasPermission('users.index');
     return view('users.profile', $data);
 }