/**
  * Display a listing of reportgroupings
  *
  * @return Response
  */
 public function index($report_id)
 {
     if (!ReportGrouping::canList()) {
         return $this->_access_denied();
     }
     if (Request::ajax()) {
         $users_under_me = Auth::user()->getAuthorizedUserids(ReportGrouping::$show_authorize_flag);
         if (empty($users_under_me)) {
             $reportgroupings = ReportGrouping::whereNotNull('report_groupings.created_at');
         } else {
             $reportgroupings = ReportGrouping::whereIn('report_groupings.user_id', $users_under_me);
         }
         $reportgroupings->where('report_id', $report_id);
         $reportgroupings = $reportgroupings->select(['report_groupings.id', 'report_groupings.name', 'report_groupings.label', 'report_groupings.id as actions']);
         return Datatables::of($reportgroupings)->edit_column('actions', function ($reportgrouping) use($report_id) {
             $actions = [];
             $actions[] = $reportgrouping->canShow() ? link_to_action('ReportGroupingsController@show', 'Show', [$report_id, $reportgrouping->id], ['class' => 'btn btn-xs btn-primary']) : '';
             $actions[] = $reportgrouping->canUpdate() ? link_to_action('ReportGroupingsController@edit', 'Update', [$report_id, $reportgrouping->id], ['class' => 'btn btn-xs btn-default']) : '';
             $actions[] = $reportgrouping->canDelete() ? Former::open(action('ReportGroupingsController@destroy', [$report_id, $reportgrouping->id]))->class('form-inline') . Former::hidden('_method', 'DELETE') . '<button type="button" class="btn btn-xs btn-danger confirm-delete">Delete</button>' . Former::close() : '';
             return implode(' ', $actions);
         })->remove_column('id')->make();
         return Datatables::of($reportgroupings)->make();
     }
     Asset::push('js', 'datatables');
     return View::make('reportgroupings.index', compact('report_id'));
 }
示例#2
1
 public function __construct(Request $request)
 {
     $this->currentModel = new Content();
     $this->langModel = new ContentLang();
     $this->validation = \Validator::make($request->all(), ['name' => 'required:structure|max:255']);
     $modelStructure = new Structure();
     $treeStructure = $modelStructure->get()->sortBy('position');
     foreach ($treeStructure as $key => $struct) {
         $lang = StructureLang::where(['structure_id' => $struct['id'], 'language_id' => FormLang::getCurrentLang()])->first();
         if ($lang) {
             $treeStructure[$key]->name = $lang->name;
             $treeStructure[$key]->link = action('\\Application\\Admin\\Http\\Controllers\\StructureController@getEdit', ['id' => $struct['id']]);
         } else {
             unset($treeStructure[$key]);
         }
     }
     $treeStructure->linkNodes();
     $str = $treeStructure->toArray();
     $witgetStructureTree = new TreeBuilder();
     $TreeStructure = $witgetStructureTree->view($str, '<ul>{val}</ul>', '<li data-href="/admin/content/structure/{id}">{name}</li>', '<li data-href="/admin/content/structure/{id}" class="folder expanded">{name}<ul>{|}</ul></li>');
     view()->share('StructureTree', $TreeStructure);
     view()->share('id_structure', $request->route('id_structure'));
     $this->itemName = 'Content';
     $this->template = 'content';
     $this->layout = 'dual_sidebars';
     parent::__construct();
 }
示例#3
1
 public function slots()
 {
     $user = Auth::user();
     $location = $user->location;
     $slot = Slot::where('location', '=', $location)->first();
     $input = Input::get('wager');
     $owner = User::where('name', '=', $slot->owner)->first();
     $num1 = rand(1, 10);
     $num2 = rand(5, 7);
     $num3 = rand(5, 7);
     if ($user->name != $owner->name) {
         if ($num1 & $num2 & $num3 == 6) {
             $money = rand(250, 300);
             $payment = $money += $input * 1.75;
             $user->money += $payment;
             $user->save();
             session()->flash('flash_message', 'You rolled three sixes!!');
             return redirect('/home');
         } else {
             $user->money -= $input;
             $user->save();
             $owner->money += $input;
             $owner->save();
             session()->flash('flash_message_important', 'You failed to roll three sixes!!');
             return redirect(action('SlotsController@show', [$slot->location]));
         }
     } else {
         session()->flash('flash_message_important', 'You own this slot!!');
         return redirect(action('SlotsController@show', [$slot->location]));
     }
 }
示例#4
0
    public function schoolbyalph()
    {
        if (\Request::ajax()) {
            $caracter = Input::get('caracter');
            $ecoles = User::where('type', 'ecole')->where('name', 'LIKE', $caracter . '%')->get();
            foreach ($ecoles as $ecole) {
                echo '<tr>
                            <td><div class="minimal single-row">
                                    <div class="checkbox_liste ">
                                        <input value="' . $ecole->id . '" type="checkbox" name="select[]" >

                                    </div>
                                </div></td>
                            <td>' . $ecole->name . '</td>
                            <td>' . $ecole->created_at->format('d-m-Y') . '</td>
                            <td><span class="label label-success label-mini"><i class="fa fa-money"></i></span></td>
                            <td>
                                <a href="#" class="actions_icons">
                                    <i class="fa fa-trash-o liste_icons"></i></a>
                                <a href="#"><i class="fa fa-archive liste_icons"></i>
                                </a>
                            </td>

                            <td><a href="' . action('SchoolsController@show', [$ecole->id]) . '"><div  class="btn_details">Détails</div></a></td>
                        </tr> ';
            }
        }
    }
 public function upload()
 {
     if (Session::get('isLogged') == true) {
         return \Plupload::file('file', function ($file) {
             // екстракт на наставката
             $originName = $file->getClientOriginalName();
             $array = explode('.', $originName);
             $extension = end($array);
             // името без наставка
             $name = self::normalizeString(pathinfo($originName, PATHINFO_FILENAME));
             // base64 од името на фајлот
             $fileName = base64_encode($name) . '.' . $extension;
             // пат до фајлот
             $path = storage_path() . '\\upload\\' . Session::get('index') . '\\' . $fileName;
             if (!File::exists($path)) {
                 // фајловите се чуваат во storage/upload/brIndeks/base64(filename).extension
                 $file->move(storage_path('upload/' . Session::get('index')), $fileName);
                 return ['success' => true, 'message' => 'Upload successful.', 'deleteUrl' => action('FileController@delete', [$file])];
             } else {
                 return ['success' => false, 'message' => 'File with that name already exists!', 'deleteUrl' => action('FileController@delete', [$file])];
             }
         });
     } else {
         abort(404);
     }
 }
示例#6
0
 public function postForm(FormCategoryRequest $request)
 {
     if (!empty($request)) {
         $pathImage = $request->get('picture', null);
         $data = $request->all();
         if ($request->hasfile('picture')) {
             $validator = Validator::make($request->all(), ['picture' => ['mimes:jpg,png,jpeg']]);
             if ($validator->fails()) {
                 return redirect(action('Admin\\CategoryController@postForm'))->withErrors($validator)->withInput();
             }
             $file = $request->file('picture');
             $nameimage = date('Ymdhis') . rand(1, 1000) . '.' . $file->getClientOriginalExtension();
             $file->move(public_path() . "/dinamic/category/", $nameimage);
             $pathImage = '/dinamic/category/' . $nameimage;
             $data['picture'] = $pathImage;
         }
         $data['flagactive'] = $request->get('flagactive', 1);
         if ($request->id) {
             $obj = Categories::find($request->id);
             $obj->update($data);
             $idTips = $obj->id;
         } else {
             $obj = Categories::create($data);
             $idTips = $obj->id;
         }
         return redirect('admpanel/' . self::NAMEC)->with('messageSuccess', 'Caracteristicas Guardado');
     }
     return redirect('admpanel')->with('messageError', 'Error al guardar el tip');
 }
示例#7
0
 public function getOAuth()
 {
     $code = $this->poniverse->getClient()->getAccessToken(Config::get('poniverse.urls')['token'], 'authorization_code', ['code' => Input::query('code'), 'redirect_uri' => action('AuthController@getOAuth')]);
     if ($code['code'] != 200) {
         if ($code['code'] == 400 && $code['result']['error_description'] == 'The authorization code has expired' && !isset($this->request['login_attempt'])) {
             return Redirect::to($this->poniverse->getAuthenticationUrl('login_attempt'));
         }
         return Redirect::to('/')->with('message', 'Unfortunately we are having problems attempting to log you in at the moment. Please try again at a later time.');
     }
     $this->poniverse->setAccessToken($code['result']['access_token']);
     $poniverseUser = $this->poniverse->getUser();
     $token = DB::table('oauth2_tokens')->where('external_user_id', '=', $poniverseUser['id'])->where('service', '=', 'poniverse')->first();
     $setData = ['access_token' => $code['result']['access_token'], 'expires' => date('Y-m-d H:i:s', strtotime("+" . $code['result']['expires_in'] . " Seconds", time())), 'type' => $code['result']['token_type']];
     if (isset($code['result']['refresh_token']) && !empty($code['result']['refresh_token'])) {
         $setData['refresh_token'] = $code['result']['refresh_token'];
     }
     if ($token) {
         //User already exists, update access token and refresh token if provided.
         DB::table('oauth2_tokens')->where('id', '=', $token->id)->update($setData);
         return $this->loginRedirect(User::find($token->user_id));
     }
     // Check by login name to see if they already have an account
     $user = User::findOrCreate($poniverseUser['username'], $poniverseUser['display_name'], $poniverseUser['email']);
     if ($user->wasRecentlyCreated) {
         return $this->loginRedirect($user);
     }
     // We need to insert a new token row :O
     $setData['user_id'] = $user->id;
     $setData['external_user_id'] = $poniverseUser['id'];
     $setData['service'] = 'poniverse';
     DB::table('oauth2_tokens')->insert($setData);
     return $this->loginRedirect($user);
 }
示例#8
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(ModuleRequest $request, $id)
 {
     $module = Module::findOrFail($id);
     $module->update($request->all());
     flash()->success(trans('all.module_edited'));
     return redirect(action('Admin\\ModulesController@index'));
 }
示例#9
0
 public function update(Request $request, $id)
 {
     $inbound = Inbound::whereId($id)->firstOrFail();
     $inbound->ticket = $request->get('ticket');
     $inbound->delivrery_date = $request->get('delivrery_date');
     $inbound->delivery_time = $request->get('delivery_time');
     $inbound->producer = $request->get('producer');
     $inbound->commodity = $request->get('commodity');
     $inbound->gross = $request->get('gross');
     $inbound->tare = $request->get('tare');
     $inbound->net = $request->get('net');
     $inbound->driver_on = $request->get('driver_on');
     $inbound->bushel_weight = $request->get('bushel_weight');
     $inbound->bushels = $request->get('bushels');
     $inbound->truck_id = $request->get('truck_id');
     $inbound->trucking_company = $request->get('trucking_company');
     $inbound->driver = $request->get('driver');
     $inbound->trailer_license = $request->get('trailer_license');
     $inbound->grade = $request->get('grade');
     $inbound->moisture = $request->get('moisture');
     $inbound->test_weight = $request->get('test_weight');
     $inbound->damage = $request->get('damage');
     $inbound->heat_damage = $request->get('heat_damage');
     $inbound->fm = $request->get('fm');
     $inbound->splits = $request->get('splits');
     $inbound->other = $request->get('other');
     $inbound->base_price = $request->get('base_price');
     $inbound->total_disc = $request->get('total_disc');
     $inbound->net_price = $request->get('net_price');
     $inbound->reason_for_rejection = $request->get('reason_for_rejection');
     $inbound->save();
     Toastr::success('Inbound updated.');
     return redirect(action('InboundsController@index', $inbound->{$inbound}));
 }
 public function getIndex(Request $request)
 {
     $signed_request = $request->get("signed_request");
     list($encoded_sig, $payload) = explode('.', $signed_request, 2);
     $secret = "fce58f5059082b9ed47e19f3138d2e9a";
     // Use your app secret here
     // decode the data
     $sig = $this->base64_url_decode($encoded_sig);
     $data = json_decode($this->base64_url_decode($payload), true);
     $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
     if ($sig !== $expected_sig) {
         throw new \Exception("Something went bad");
     }
     if (isset($data["oauth_token"]) && $data["oauth_token"] && isset($data["oauth_token"]) && $data["oauth_token"]) {
         //the user is logged in
         //if the user id exists on our DB than login the user and redirect him to dashboard
         //if the user id does not exist than show the registration page
         $user = $this->user->getUserByFacebookID($data["user_id"]);
         if ($user && $user->count()) {
             Auth::login($user);
             return Redirect::to(action("DashBoardController@getIndex"));
         }
         $facebook_user_data = json_decode(file_get_contents('https://graph.facebook.com/me?access_token=' . $data["oauth_token"]), true);
         Session::put("user_email", $facebook_user_data["email"]);
         Session::put("facebook_id", $data["user_id"]);
         return Redirect::to(action('RegistrationController@getFacebook'));
     }
     $app_id = config("offside.facebook")['app_id'];
     $redirect_url = "http://apps.facebook.com/offsidefootball/";
     $loginUrl = "https://www.facebook.com/dialog/oauth?scope=email&client_id={$app_id}&redirect_uri={$redirect_url}";
     echo '<script>top.location="' . $loginUrl . '";</script>';
 }
示例#11
0
 public function postForm(FormAdminRequest $request)
 {
     try {
         $dataAdmin = $request->all();
         $password = $request->get('password', null);
         if (isset($dataAdmin['id']) && $dataAdmin['id'] != '') {
             $data = $request->except(array('password'));
             $runtime = User::find($dataAdmin['id']);
             $runtime->fill($data);
             $runtime->password = $runtime->password;
             if (!empty($password)) {
                 $runtime->password = Hash::make($password);
             }
             $runtime->save();
             $msg = 'Usuario Editado!';
         } else {
             $role = Role::whereName(User::ROL_CONTENIDO_ADMIN)->first();
             $dataAdmin['password'] = Hash::make($password);
             $NewUser = User::create($dataAdmin);
             $msg = 'Usuario Guardado!';
             RoleUser::create(['user_id' => $NewUser->id, 'role_id' => $role->id]);
         }
         return redirect(action('Admin\\AdminController@getIndex'))->with('messageSuccess', $msg);
     } catch (Exception $exc) {
         dd($exc->getMessage());
     }
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $galleriesQueryBuilder = Gallery::where('ignore_this_site', '=', 0);
     $narrowColumns = [(new FieldConfig('id'))->setLabel('Actions')->setSortable(true)->setCallback(function ($val) {
         $iconShow = '<span class="fa fa-eye"></span>&nbsp;';
         $hrefShow = action('GalleriesController@show', [$val]);
         $iconUpdate = '<span class="fa fa-pencil"></span>&nbsp;';
         $hrefUpdate = action('GalleriesController@edit', [$val]);
         $iconDelete = '<span class="fa fa-times"></span>&nbsp;';
         $hrefDelete = action('GalleriesController@delete', [$val]);
         return '<a href="' . $hrefShow . '">' . $iconShow . '</a>&emsp;' . '<a href="' . $hrefUpdate . '">' . $iconUpdate . '</a>&emsp;' . '<a href="' . $hrefDelete . '">' . $iconDelete . '</a>';
     }), (new FieldConfig('name'))->setSortable(true)->setSorting(Grid::SORT_ASC), (new FieldConfig('url'))->setCallback(function ($val) {
         return '<a href="' . $val . '" target="_blank">' . $val . '</a>';
     })];
     $additionalColumns = [(new FieldConfig('accepts_submissions'))->setLabel('AS')->setCallback(function ($val) {
         if ($val) {
             return '<span class="fa fa-check"></span>&nbsp;';
         }
     }), (new FieldConfig('reblog_posts'))->setLabel('RP')->setCallback(function ($val) {
         if ($val) {
             return '<span class="fa fa-check"></span>&nbsp;';
         }
     }), (new FieldConfig('reblogs'))->setSortable(true)];
     $wideColumns = array_merge($narrowColumns, $additionalColumns);
     $narrowCfg = (new GridConfig())->setDataProvider(new EloquentDataProvider($galleriesQueryBuilder))->setColumns($narrowColumns);
     $narrowGrid = new Grid($narrowCfg);
     $wideCfg = (new GridConfig())->setDataProvider(new EloquentDataProvider($galleriesQueryBuilder))->setColumns($wideColumns);
     $grid = new Grid($wideCfg);
     return array('narrowGrid' => $narrowGrid, 'grid' => $grid);
 }
示例#13
0
    private static function recursia()
    {
        $menu = static::getMenuModel();
        $url = urldecode(url('/'));
        $url = explode('/', $url);
        //        echo '<pre>';
        //        print_r();
        $all = $menu::all();
        ?>

        <ul class="breadcrumb">
            <li><a href="<?php 
        echo action('cp\\HomeController@index');
        ?>
">Home</a></li>
            <?php 
        foreach ($all as $index => $item) {
            $item = json_decode($item);
            if ((int) $item->category === 0) {
                //                print_r($url);
                //                print_r($item);
            }
        }
        //            die;
        ?>
        </ul>

        <?php 
    }
示例#14
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->user()) {
         return redirect(action('ErrorsController@show', 404));
     }
     return $next($request);
 }
示例#15
0
 /**
  * 检测登录
  *
  * @return bool|\Illuminate\Http\RedirectResponse
  * @author yangyifan <*****@*****.**>
  */
 private function checkIsLogin()
 {
     load_func('common');
     $uid = is_admn_login();
     return $uid <= 0 && header('location:' . action('Admin\\LoginController@getIndex'));
     die;
 }
示例#16
0
 public function store(\Illuminate\Http\Request $request)
 {
     $this->validate($request, ['cname' => 'required', 'cphone' => 'required', 'cemail' => 'required']);
     $contact = new Contact(['name' => $request->input('cname'), 'phone' => $request->input('cphone'), 'email' => $request->input('cemail'), 'user_id' => Auth::user()->id]);
     $contact->save();
     return redirect(action('ContactController@index'));
 }
示例#17
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->user()) {
         return redirect(action('Admin\\HomeController@index'));
     }
     return $next($request);
 }
 protected function getActionUrl($action, $controller = null, $parameters = []) : string
 {
     if ($this->isShopTestCase()) {
         return action($this->getAction($action, $controller), (array) $parameters + ['currentShop' => $this->getShop()->id]);
     }
     return action($this->getAction($action, $controller), $parameters);
 }
示例#19
0
 public function getCheckout()
 {
     $payer = PayPal::Payer();
     $payer->setPaymentMethod('paypal');
     $amount = PayPal::Amount();
     $amount->setCurrency('EUR');
     $amount->setTotal(42);
     // This is the simple way,
     // you can alternatively describe everything in the order separately;
     // Reference the PayPal PHP REST SDK for details.
     $transaction = PayPal::Transaction();
     $transaction->setAmount($amount);
     $transaction->setDescription('What are you selling?');
     $redirectUrls = PayPal::RedirectUrls();
     $redirectUrls->setReturnUrl(action('PayPalController@getDone'));
     $redirectUrls->setCancelUrl(action('PayPalController@getCancel'));
     $payment = PayPal::Payment();
     $payment->setIntent('sale');
     $payment->setPayer($payer);
     $payment->setRedirectUrls($redirectUrls);
     $payment->setTransactions(array($transaction));
     $response = $payment->create($this->_apiContext);
     $redirectUrl = $response->links[1]->href;
     return Redirect::to($redirectUrl);
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $setData['actionLink'] = action('Admin\\LocationController@store');
     $setData['action'] = 'create';
     $setData['data'] = [];
     return View::make('admin.location.add_edit', $setData);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(CourseRequest $request, $id)
 {
     //
     $courses = Courses::findorfail($id);
     $courses->update($request->all());
     return redirect(action('CoursesController@index'));
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     if ($this->newOnly) {
         $photosQueryBuilder = Photo::where('posted_date', '=', '0000-00-00');
     } else {
         $photosQueryBuilder = Photo::where('id', '>', 0);
     }
     $photos = $photosQueryBuilder->get();
     $gridColumns = [(new FieldConfig('id'))->setLabel('Actions')->setSortable(true)->setCallback(function ($val, EloquentDataRow $row) {
         $rowData = $row->getSrc();
         $iconShow = '<span class="fa fa-eye"></span>&nbsp;';
         $hrefShow = action('PhotosController@show', [$val]);
         $iconUpdate = '<span class="fa fa-pencil"></span>&nbsp;';
         $hrefUpdate = action('PhotosController@edit', [$val]);
         $iconDelete = '<span class="fa fa-times"></span>&nbsp;';
         $hrefDelete = action('PhotosController@delete', [$val]);
         $iconTumblr = '<span class="fa fa-tumblr-square"></span>&nbsp;';
         $hrefTumblr = $rowData->url;
         return '<a href="' . $hrefShow . '">' . $iconShow . '</a>&emsp;' . '<a href="' . $hrefUpdate . '">' . $iconUpdate . '</a>&emsp;' . '<a href="' . $hrefDelete . '">' . $iconDelete . '</a>&emsp;' . '<a href="' . $hrefTumblr . '" target="_blank">' . $iconTumblr . '</a>';
     }), (new FieldConfig('file_name'))->setLabel('Photo')->setCallback(function ($val, EloquentDataRow $row) {
         $rowData = $row->getSrc();
         $image = '<img src="/photo_files/thumbnail/' . $val . '" />';
         $hrefShow = action('PhotosController@show', [$rowData->id]);
         return '<a href="' . $hrefShow . '">' . $image . '</a>';
     }), (new FieldConfig('posted_date'))->setSortable(true)->setSorting(Grid::SORT_DESC), (new FieldConfig('notes'))->setSortable(true), (new FieldConfig('notes_last30'))->setSortable(true)->setLabel('Last 30 Days'), (new FieldConfig('notes_last10'))->setSortable(true)->setLabel('Last 10 Days')];
     $gridCfg = (new GridConfig())->setDataProvider(new EloquentDataProvider($photosQueryBuilder))->setColumns($gridColumns);
     $grid = new Grid($gridCfg);
     return array('narrowGrid' => null, 'grid' => $grid);
 }
示例#23
0
 /**
  * 处理注册操作
  *
  * @return Response
  * @author yangyifan <*****@*****.**>
  */
 public function postRegister(UserRegisterRequest $request)
 {
     $input = $request->only('email', 'mobile', 'password', 'password_confirmation');
     //写入数据
     $affected_number = UserModel::register($input);
     return $affected_number->id > 0 ? $this->response(200, trans('response.register_success'), [], true, action('Home\\UserController@getLogin')) : $this->response(400, trans('response.register_error'), [], true);
 }
示例#24
0
    public function attbyalph()
    {
        if (\Request::ajax()) {
            $caracter = \Input::get('caracter');
            $enfants = Child::where('nom_enfant', 'LIKE', $caracter . '%')->where('user_id', \Auth::user()->id)->get();
            foreach ($enfants as $enfant) {
                echo '   <tr>
                            <td><div class="minimal single-row">
                                    <div class="checkbox_liste ">
                                        <input type="checkbox" value=" ' . $enfant->id . ' " >

                                    </div>
                                </div></td>
                            <td><img class="avatar" src=" ' . asset('uploads/' . $enfant->photo) . '"></td>
                            <td>' . $enfant->nom_enfant . '</td>
                            <td>15-09-2015 </td>
                            <td>
                                <a href="#" class="actions_icons">
                                    <i class="fa fa-trash-o liste_icons"></i></a>
                                <a href="#"><i class="fa fa-archive liste_icons"></i>
                                </a>
                            </td>

                            <td><a href="' . action('AttendancesController@show', [$enfant->id]) . '"><div  class="btn_details">Détails</div></a></td>
                        </tr>';
            }
        }
    }
示例#25
0
 public function postBlock(Request $request)
 {
     if (!\Block::write($request->input('title'), $request->input('code'))) {
         return back()->withInput($request->all())->withMsg('Ошибка, не удалось записать блок.');
     }
     return redirect(action('\\Scrobot\\Blocks\\BlockController@getIndex'))->withMsg('Успешно.');
 }
示例#26
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $load
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, Setting $setting)
 {
     Cache::forget('settings');
     $setting->updateSettings($request, ['site_title', 'site_tags', 'site_description', 'allow_registration', 'pagination_num']);
     flash()->success(trans('all.entry_updated'));
     return redirect(action('Admin\\SettingsController@index'));
 }
示例#27
0
 /**
  * 메뉴의 링크를 생성하여 반환한다. 메뉴에 link정보가 있을 경우 link정보를 우선 사용하여 생성한다.
  * 그 다음으로 메뉴에 연결된 route정보를 사용하여 링크를 생성한다.
  *
  * @return Route|mixed|string
  * @throws \Exception
  */
 public function link()
 {
     if ($this->display === false) {
         return '#';
     }
     // menu에 링크 정보가 있을 경우
     if ($this->link !== null) {
         if ($this->link instanceof Closure) {
             return $this->link();
         } else {
             return $this->link;
         }
     }
     // 어떤 링크정보도 찾을 수 없으면 #
     if ($this->route === null) {
         return '#';
     }
     // route 정보 사용
     if ($name = $this->route->getName()) {
         return route($name);
     } elseif ($action = $this->route->getActionName()) {
         if ($action !== 'Closure') {
             return action($action);
         }
     }
     throw new LinkNotFoundException('admin 메뉴가 지정된 route는 name(as)이 지정되어 있거나 Controller action이어야 합니다.');
 }
 public function addProduct()
 {
     $id = \Input::get('id');
     $rules = array('name' => 'required', 'quantity' => 'required|numeric', 'image' => 'image|mimes:jpeg,jpg,png,gif');
     $input = \Input::all();
     $valid = Validator::make($input, $rules);
     if ($valid->fails()) {
         return \Redirect::back()->withErrors($valid);
     } else {
         // If validation success
         $name = \Input::get('name');
         $quantity = \Input::get('quantity');
         $image = \Input::file('image');
         $product = $id ? Products::find($id) : new Products();
         // Creating product elobquent object
         // If image selected
         if ($image) {
             $filename = time() . "-" . $image->getClientOriginalName();
             $path = 'assets/images/' . $filename;
             \Image::make($image->getRealPath())->resize(200, 200)->save($path);
             $existingImage = '/assets/images/' . $product->image;
             if (file_exists($existingImage)) {
                 \File::delete($existingImage);
             }
             $product->image = $filename;
         }
         $product->name = $name;
         $product->quantity = $quantity;
         $product->save();
         return redirect(action('ProductController@product'));
     }
 }
示例#29
0
 public function show($slug)
 {
     $course = Course::where('slug', $slug)->firstOrFail();
     $breadcrumbs = array(action('HomeController@show') => 'Início', action('CourseController@all') => 'Cursos', action('CourseController@show', $slug) => $course->name);
     $previous = action('CourseController@all');
     return view('course', compact('breadcrumbs', 'previous', 'course'));
 }
示例#30
0
 /**
  * Create a new authentication controller instance.
  * @param IAuthService $authService
  */
 public function __construct(IAuthService $authService)
 {
     $this->middleware('guest', ['except' => 'getLogout']);
     $this->redirectPath = action('DashboardController@getIndex');
     $this->loginPath = action('Auth\\AuthController@getLogin');
     $this->authService = $authService;
 }