action() 공개 정적인 메소드

Get the URL to a controller action.
public static action ( string $action, mixed $parameters = [], boolean $absolute = true ) : string
$action string
$parameters mixed
$absolute boolean
리턴 string
예제 #1
2
 public function echoMenu($items)
 {
     foreach ($items as $key => $item) {
         if (!array_key_exists($item->id, $this->echoed)) {
             $this->countLevel($item);
             $this->echoed[$item->id] = $this->level;
             echo '<tr><td>';
             for ($i = 0; $i < $this->echoed[$item->id]; $i++) {
                 echo "--";
             }
             echo " " . $item->id . '</td>
                 <td>' . __(dots($item->title, 90)) . '</td>
                 <td><a class="btn btn-primary" href="' . _l(URL::action('MenuController@getItemEdit') . '/' . $item->id) . '">' . __(Lang::get('admin.edit')) . '</a></td>
                 <td><a href="#" data-toggle="modal" data-target="#confirm-delete" class="btn btn-danger" data-href="' . URL::action('MenuController@getItemDestroy') . '/' . $item->id . '">' . __(Lang::get('admin.delete')) . '</a></td>
             </tr>';
         }
         if ($item->children()->count() > 0) {
             $this->echoMenu($item->children);
         }
     }
 }
 public function getUrl($url = null)
 {
     if (empty($url)) {
         $url = URLHelperFacade::canonicalizeHost(\URL::action('Media\\IndexController@index'));
     }
     return $url;
 }
예제 #3
0
 public function getVideo()
 {
     $url = \URL::action('loggedController@saveVideo');
     $title1 = 'Add';
     $title = 'Video';
     return view('addVideo')->with('url', $url)->with('title1', $title1)->with('title', $title);
 }
 /**
  * Builds the current route controller with given action name and parameters
  * @param string $action
  * @param array $parameters
  * @return string
  */
 protected function getCurrentActionURL($action, $parameters = [])
 {
     // build the controller name with the action
     $url = $this->getCurrentActionForName($action);
     // return the action url with given parameters
     return \URL::action($url, $parameters);
 }
예제 #5
0
 public function index()
 {
     $users = DB::table(DB_USERS)->whereIn('role', array_keys(self::$roles))->orderBy('name')->get();
     foreach ($users as &$user) {
         $user->role = self::$roles[$user->role];
         $user->link = URL::action('UserController@edit', $user->id);
         $user->delete = URL::action('UserController@delete', $user->id);
     }
     return View::make('avalon::users.index', array('users' => $users));
 }
예제 #6
0
 public function index($object_name)
 {
     $object = DB::table(DB_OBJECTS)->where('name', $object_name)->first();
     $fields = DB::table(DB_FIELDS)->where('object_id', $object->id)->orderBy('precedence')->get();
     foreach ($fields as &$field) {
         $field->link = URL::action('FieldController@edit', array($object->name, $field->id));
         $field->type = trans('avalon::messages.fields_types_' . $field->type);
     }
     return View::make('avalon::fields.index', ['object' => $object, 'fields' => $fields]);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$this->userService->isSignedIn()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest(\URL::action('User\\AuthController@getSignIn'));
         }
     }
     view()->share('authUser', $this->userService->getUser());
     return $next($request);
 }
예제 #8
0
 public function postComment(AddCommentRequest $request)
 {
     $game = Game::where('instanceId', $request->get('game_id'))->first();
     $membershipId = $this->user->account->destiny->membershipId;
     $comment = new Comment();
     $comment->comment = $request->get('message');
     $comment->membershipId = $membershipId;
     $comment->characterId = $game->findAccountViaMembershipId($membershipId, false)->characterId;
     $comment->parent_comment_id = 0;
     $game->comments()->save($comment);
     return response()->json(['flag' => true, 'url' => \URL::action('Destiny\\GameController@getGame', $game->instanceId)]);
 }
예제 #9
0
 public function manage($class)
 {
     $controller = $this->getController($class);
     $model = $controller->getModelBuilder()->getName();
     $fb = $this->formBuilder;
     $fb->action(\URL::action(get_called_class() . '@createController'));
     $fb->text('original')->label('Original controller')->value(get_class($controller));
     $fb->text('controller')->label('Controller name')->value($model . 'Controller');
     $fb->text('path')->label('Path')->value('../app/controllers');
     $form = $fb->build();
     return View::make('crud::manager/manage', compact('form'));
 }
예제 #10
0
 public function index()
 {
     $objects = DB::table(DB_OBJECTS)->join(DB_USERS, DB_USERS . '.id', '=', DB_OBJECTS . '.updated_by')->select(DB_OBJECTS . '.*', DB_USERS . '.name AS updated_name')->orderBy('list_grouping')->orderBy('title')->get();
     foreach ($objects as &$object) {
         $object->link = URL::action('InstanceController@index', $object->name);
         $object->updated_by = $object->name;
         if ($object->count == 0) {
             $object->instance_count = '';
         }
     }
     return View::make('avalon::objects.index', ['objects' => $objects]);
 }
예제 #11
0
 /**
  * @param $user
  * @param $all
  * @return string
  */
 public static function buildRSVPResponse($user, $all)
 {
     $msg = '';
     // Lets check if char_id is 0, if so. Let the user know of their chars with numbers to pick one.
     if (intval($all['char_id']) == 0) {
         $count = 0;
         $msg = 'I need to know which character you want to be <strong>' . $user->account->gamertag . '</strong> for this event. Below are your characters with a number next to them. <br /><br />';
         foreach ($user->account->destiny->characters as $char) {
             $msg .= ++$count . ". - " . $char->name() . " " . $char->highest_light . "/" . $char->light . "<br />";
         }
         $msg .= '<br />Your new command will be <strong>/bot rsvp ' . $all['game_id'] . ' #</strong> Where # is one of the numbers above.';
     } else {
         // does this char even exist
         $char = $user->account->destiny->characterAtPosition($all['char_id']);
         if ($char instanceof Character) {
             try {
                 $event = GameEvent::where('id', intval($all['game_id']))->firstOrFail();
                 if ($event->isFull()) {
                     $msg = 'Ouch sorry man. This event is Full. No more RSVPs allowed';
                 } else {
                     if ($event->isAttending($user)) {
                         $msg = 'O think your slick eh? You are already attending this event. There is nothing you need to do.';
                     } else {
                         if ($event->isOver()) {
                             $msg = 'Sorry this event is over. No more RSVPs are allowed.';
                         } else {
                             $attendee = new Attendee();
                             $attendee->game_id = $event->id;
                             $attendee->membershipId = $user->account->destiny_membershipId;
                             $attendee->characterId = $char->characterId;
                             $attendee->account_id = $user->account->id;
                             $attendee->user_id = $user->id;
                             $attendee->save();
                             $msg = 'Congrats <strong> ' . $user->account->gamertag . '</strong> you have sealed a spot in this ';
                             $msg .= '<a href="' . \URL::action('CalendarController@getEvent', [$event->id]) . '">event</a>. There are <strong>' . ($event->spotsRemaining() - 1) . '</strong> spots remaining.';
                         }
                     }
                 }
             } catch (ModelNotFoundException $e) {
                 $msg = 'Sorry to break the news to you, but this event does not exist. Please try a different gameId.';
             }
         } else {
             $count = 0;
             $msg = 'Trying to be funny I see. That character does not exist for you. I guess I have to remind you. <br /><br />';
             foreach ($user->account->destiny->characters as $char) {
                 $msg .= ++$count . ". - " . $char->name() . " " . $char->highest_light . "/" . $char->light . "<br />";
             }
             $msg .= '<br />Your new command will be <strong>/bot rsvp ' . $all['game_id'] . ' #</strong> Where # is one of the numbers above.';
         }
     }
     return $msg;
 }
예제 #12
0
 public function index()
 {
     if ($tables = array_diff(ObjectController::getTables(), self::getAvalonTables())) {
         foreach ($tables as &$table) {
             $table = '\'' . $table . '\'';
         }
         $tables = DB::select('SHOW TABLE STATUS WHERE Name IN (' . implode(',', $tables) . ')');
         foreach ($tables as &$table) {
             $table->link = URL::action('ImportController@show', $table->Name);
             $table->Data_length = self::formatBytes($table->Data_length);
         }
     }
     return View::make('avalon::import.index', compact('tables'));
 }
예제 #13
0
파일: Button.php 프로젝트: hpolthof/admin
 public function render()
 {
     $icon = '';
     if ($this->icon != null) {
         $icon = "<i class='fa fa-fw {$this->icon}'></i>";
     }
     $url = '#';
     if ($this->action != null) {
         $url = \URL::action($this->action, $this->data);
     }
     if ($this->url != null) {
         $url = $this->url;
     }
     return "<a target='{$this->target}' class='btn {$this->class}' href='{$url}'>{$icon}{$this->text}</a>";
 }
예제 #14
0
파일: Auth.php 프로젝트: nathanking101/core
 public function post_login()
 {
     $login_data = array('username' => \Input::get('req_username'), 'password' => \Input::get('req_password'));
     // TODO: Add remember me setting once supported by Illuminate
     if (\Auth::attempt($login_data)) {
         // Make sure last_visit data is properly updated
         \Session::sweep();
         // TODO: This is properly validated in URL::to, right?
         $redirect_url = \Input::get('redirect_url', \URL::action('fluxbb::home@index'));
         return \Redirect::to($redirect_url)->with('message', 'You were successfully logged in.');
     } else {
         $errors = new \Illuminate\Validation\MessageBag();
         $errors->add('login', 'Invalid username / password combination.');
         return \Redirect::action('fluxbb::auth@login')->withInput(\Input::all())->with('errors', $errors);
     }
 }
예제 #15
0
 public static function getTagCloud()
 {
     $products = self::join('fbf_food_product_recipe', 'fbf_food_products.id', '=', 'fbf_food_product_recipe.product_id')->join('fbf_food_recipes', 'fbf_food_product_recipe.recipe_id', '=', 'fbf_food_recipes.id')->select(\DB::raw('fbf_food_products.*, COUNT(fbf_food_product_recipe.recipe_id) as num_recipes'))->live()->where('fbf_food_recipes.status', '=', Recipe::APPROVED)->where('fbf_food_recipes.published_date', '<=', \Carbon\Carbon::now())->groupBy('fbf_food_products.id')->orderBy('fbf_food_products.name', 'asc')->get();
     $results = array();
     $maxRecipes = 0;
     foreach ($products as $product) {
         $maxRecipes = max($maxRecipes, $product->num_recipes);
     }
     foreach ($products as $product) {
         if ($product->num_recipes == 0) {
             continue;
         }
         $results[] = array('name' => $product->name, 'url' => \URL::action('Fbf\\LaravelFood\\RecipesController@indexByProduct', array('productSlug' => $product->slug)), 'weight' => round($product->num_recipes / $maxRecipes, 1) * 10);
     }
     return $results;
 }
예제 #16
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex()
 {
     if (Session::get('user_level') < Config::get('cms.shopManager')) {
         return Redirect::to(_l(URL::action('AdminHomeController@getIndex')));
     }
     $this->setLayout();
     if (Input::get('q')) {
         $products = Product::where(function ($query) {
             $query->where('title', 'LIKE', '%' . Input::get('q') . '%')->orwhere('long_content', 'LIKE', '%' . Input::get('q') . '%')->orwhere('short_content', 'LIKE', '%' . Input::get('q') . '%');
         })->orderBy('created_at', 'desc')->paginate(20);
     } else {
         $products = News::orderBy('created_at', 'desc')->paginate(20);
     }
     View::share('title', __(Lang::get('shop.products')));
     View::share('products', $products);
     $this->layout->content = View::make('backend.shop.product.index');
 }
 /**
  * Request an URL by the action name
  *
  * @param string $method
  * @param string $action
  * @param array $params
  * @return BaseControllerTestCase this for method chaining.
  */
 public function requestAction($method, $action, $params = array())
 {
     $action_url = URL::action($action, $params);
     if ($action_url == '') {
         trigger_error("Action '{$action}' does not exist");
     }
     try {
         // The following method returns Synfony's DomCrawler
         // but it will not be used when testing controllers
         $this->client->request($method, $action_url, array_merge($params, $this->requestInput));
     } catch (HttpException $e) {
         // Store the HttpException in order to check it later
         $this->lastException = $e;
     }
     return $this;
     // for method chaining
 }
예제 #18
0
 public function postReset()
 {
     //get user
     if (!($user = DB::table(DB_USERS)->where('role', '<', 4)->whereNull('deleted_at')->where('email', Input::get('email'))->first())) {
         return Redirect::action('LoginController@getReset')->with(array('error' => trans('avalon::messages.users_password_reset_error')));
     }
     //set new token every time
     $token = Str::random();
     DB::table(DB_USERS)->where('id', $user->id)->update(array('token' => $token));
     //reset link
     $link = URL::action('LoginController@getChange', array('token' => $token, 'email' => $user->email));
     //send reminder email
     Mail::send('avalon::emails.password', array('link' => $link), function ($message) use($user) {
         $message->to($user->email)->subject(trans('avalon::messages.users_password_reset'));
     });
     return Redirect::action('LoginController@getReset')->with(array('message' => trans('avalon::messages.users_password_reset_sent')));
 }
예제 #19
0
 public function postUpload($username)
 {
     $file = Input::file('cover');
     $input = array('cover' => $file);
     $rules = array('cover' => 'image');
     /*$validator = Validator::make($input, $rules);
     		if ( $validator->fails()){
     			return Response::json(['success' => false, 'errors' => $validator->getMessageBag()->toArray()]);
     		}*/
     try {
         $user = User::where('username', $username)->first();
         if (is_null($user)) {
             $user = User::findOrFail($username);
         }
         if ($user->id != Auth::id()) {
             throw new Exception("Don't have permision");
         }
     } catch (Exception $e) {
         throw $e;
     }
     $destinationPath = 'ufiles/';
     if (!file_exists('ufiles')) {
         mkdir('ufiles', 0777, true);
     }
     $filename = $this->base64UrlEncode(Auth::id()) . '_' . uniqid() . '.jpg';
     //$file->getClientOriginalName()
     $file->move($destinationPath, $filename);
     // resize image
     /*$MAX_WIDTH = 400;
     		$MAX_HEIGHT = 400;*/
     $filepath = $destinationPath . $filename;
     /*$image = new Imagick($filepath);
     		$size = $image->getImageGeometry();		
     		if ($size['width'] > $MAX_WIDTH || $size['height'] > $MAX_HEIGHT) {
     			$image->resizeimage($MAX_WIDTH, $MAX_HEIGHT, Imagick::FILTER_UNDEFINED, 1);
     			$image->writeimage($filepath);
     		}
     		$image->clear();
     		$image->destroy();*/
     $user->cover = '/' . $filepath;
     $user->save();
     return Redirect::intended(URL::action('ProfileController@getProfile', array(Auth::user()->username)));
 }
 protected function BuildProfile($EditingWhat = null, $EditingWhich = null)
 {
     $isMe = Auth::check() && intval(Auth::id()) === $this->profile->user->id;
     if (!$isMe) {
         $EditingWhat = null;
     }
     $services = [];
     foreach ($this->profile->services()->take(5)->get() as $svc) {
         $services[$svc->name] = '';
     }
     $requests = [];
     foreach ($this->profile->requests()->take(5)->get() as $req) {
         $requests[$req->name] = URL::action('RequestController@ShowRequest', [$req->id]);
     }
     $titleInfo = ['title_title' => $this->profile->name, 'title_image_subtitle' => $this->profile->max_rating === 0 ? trans('profile/profile.no_rating') : sprintf('%d / %d', $this->profile->rating, $this->profile->max_rating), 'title_image' => ''];
     $servicesList = ['theme' => 'service', 'title' => Lang::choice('shared.classes.service', 0), 'list' => $services, 'max' => '4', 'more' => '', 'right_top' => sprintf('%d %s', 0, trans('profile/profile.title.active_suffix')), 'right_bottom' => sprintf('%d %s', 0, trans('profile/profile.title.completed_suffix')), 'none' => trans('profile/profile.title.' . ($isMe ? 'my_' : '') . 'no_services')];
     $requestsList = ['theme' => 'request', 'title' => Lang::choice('shared.classes.request', 0), 'list' => $requests, 'max' => '4', 'more' => '', 'right_top' => sprintf('%d %s', 0, trans('profile/profile.title.active_suffix')), 'right_bottom' => sprintf('%d %s', 0, trans('profile/profile.title.completed_suffix')), 'none' => trans('profile/profile.title.' . ($isMe ? 'my_' : '') . 'no_requests')];
     return View::make('pages.profile.profile', ['profile' => $this->profile, 'edit' => $EditingWhat, 'edit_which' => $EditingWhich, 'is_me' => $isMe, 'page_title' => $this->profile->name, 'title_info' => $titleInfo, 'services_list' => $servicesList, 'requests_list' => $requestsList, 'skills' => ['test' => 5, 'foo' => 6, 'btest' => 5, 'bfoo' => 6, 'ctest' => 5, 'cfoo' => 6, 'dtest' => 5, 'dfoo' => 6]]);
 }
 public function postCategoryInfo($errors = array())
 {
     $root_category_id = $this->adminProductCategoryService->getRootCategoryId();
     $parent_category_id = $root_category_id;
     if (\Input::get('parent_category_id') && \Input::get('parent_category_id') != "") {
         $parent_category_id = \Input::get('parent_category_id');
     }
     $d_arr['edit_form'] = false;
     $d_arr['add_edit_mode_text'] = trans('webshoppack::admin/manageCategory.add_title');
     $category_info = array();
     if (count($errors) == 0) {
         $category_info['status'] = "active";
     }
     $category_image_details = array();
     $sel_category_id = $parent_category_id;
     $cat_url = \URL::action('Agriya\\Webshoppack\\AdminProductCategoryController@postAdd');
     if (\Input::get('category_id') && \Input::get('category_id') != $root_category_id) {
         $category_info = $this->adminProductCategoryService->populateCategory(\Input::get('category_id'));
         if (count($category_info) > 0) {
             $cat_url = \URL::action('Agriya\\Webshoppack\\AdminProductCategoryController@postEdit');
             $parent_category_id = $category_info['parent_category_id'];
             $sel_category_id = $parent_category_id;
             $d_arr['edit_form'] = true;
             $d_arr['add_edit_mode_text'] = trans('webshoppack::admin/manageCategory.edit_title');
         }
     }
     $parent_category_name = $this->adminProductCategoryService->getParentCategoryName($sel_category_id);
     $d_arr['parent_category_id'] = $parent_category_id;
     $d_arr['parent_category_name'] = $parent_category_name;
     $d_arr['category_id'] = \Input::get('category_id');
     $d_arr['root_category_id'] = $root_category_id;
     $success_msg = "";
     if (isset($_SESSION['category_info_success_msg']) && $_SESSION['category_info_success_msg']) {
         $success_msg = $_SESSION['category_info_success_msg'];
         unset($_SESSION['category_info_success_msg']);
     }
     if (count($errors) > 0) {
         return \View::make('webshoppack::admin.productCategoryInfo', compact('d_arr', 'category_info', 'category_image_details', 'cat_url', 'success_msg', 'errors'));
     } else {
         return \View::make('webshoppack::admin.productCategoryInfo', compact('d_arr', 'category_info', 'category_image_details', 'cat_url', 'success_msg'));
     }
 }
예제 #22
0
 public function postAddEvent()
 {
     $all = $this->request->all();
     if (isset($all['google_id'])) {
         try {
             $user = User::where('google_id', $all['google_id'])->where('admin', true)->firstOrFail();
             $gameEvent = new GameEvent();
             $gameEvent->fill($all);
             $gameEvent->save();
             // now lets set max_players
             $gameEvent->max_players = $gameEvent->getPlayerDefaultSize($gameEvent->type);
             $gameEvent->save();
             $msg = 'This event was created. There are <strong>' . $gameEvent->max_players . '</strong> spots left. You may apply online <a href="' . \URL::action('CalendarController@getEvent', [$gameEvent->id]) . '">here</a>.';
             $msg .= ' or you can apply via the bot via <strong>/bot rsvp ' . $gameEvent->id . '</strong>';
             return Response::json(['error' => false, 'msg' => $msg], 200);
         } catch (ModelNotFoundException $e) {
             return $this->_error('User does not have permission to make events.');
         }
     }
 }
 public static function getClientsideConfig()
 {
     $config = array();
     $pkg = self::$package;
     $locale = Config::get('app.locale');
     $locale_file = public_path() . "/packages/ahmadazimi/{$pkg}/js/i18n/elfinder.{$locale}.js";
     $connector_action = self::getConfig('connectorAction');
     foreach (self::$clientConfigNames as $key) {
         $value = Config::get("{$pkg}::{$key}");
         !is_null($value) && ($config[$key] = $value);
     }
     file_exists($locale_file) && ($config['lang'] = $locale);
     if (!isset($config['debug']) || is_null($config['debug'])) {
         $config['debug'] = Config::get('app.debug');
     }
     if (!isset($config['url']) || !$config['url']) {
         $config['url'] = \URL::action($connector_action || 'W3G\\MediaManager\\MediaManagerController@connector');
     }
     return $config;
 }
예제 #24
0
/**
 * @param array                    $params
 * @param string                   $content
 * @param Smarty_Internal_Template $smarty
 * @param boolean                  $repeat
 *
 * @throws SmartyException
 * @return string
 *
 * @author Kovács Vince
 */
function smarty_block_datatable($params, $content, Smarty_Internal_Template &$smarty, &$repeat)
{
    if (!class_exists('Datatable')) {
        throw new SmartyException('chumper/datatable not installed');
    }
    if ($repeat) {
        $options = array('language' => \Lang::get('datatable', array()), 'processing' => true, 'bProcessing' => true, 'stateSave' => true, 'autoWidth' => false, 'columns' => array());
        $table = Datatable::table();
        if (isset($params['id'])) {
            $table->setId($params['id']);
            unset($params['id']);
        }
        if (isset($params['url'])) {
            $table->setUrl($params['url']);
            unset($params['url']);
        } elseif (isset($params['action'])) {
            $table->setUrl(URL::action($params['action']));
            unset($params['action']);
        }
        if (isset($params['searching'])) {
            $options['searching'] = $params['searching'];
        }
        if (isset($params['lengthChange'])) {
            $options['lengthChange'] = $params['lengthChange'];
        }
        if (isset($params['class'])) {
            $table->setClass($params['class']);
        }
        $table->setOptions($options);
        $smarty->append('datatables', $table);
    } else {
        $tables = $smarty->getVariable('datatables')->value;
        $table = array_pop($tables);
        $smarty->assign('datatables', $tables);
        if (isset($params['view'])) {
            return $table->render($params['view']);
        }
        return $table->render('datatable');
    }
    return '';
}
예제 #25
0
 public function populateProductResources($p_id, $resource_type = '', $is_downloadable = 'No')
 {
     $d_arr = ProductResource::where('product_id', '=', $p_id)->where('resource_type', '=', $resource_type)->where('is_downloadable', '=', $is_downloadable)->orderBy('display_order', 'ASC')->get(array('id', 'resource_type', 'filename', 'ext', 'title', 'is_downloadable', 'width', 'height', 't_width', 't_height', 'l_width', 'l_height'))->toArray();
     $resources_arr = array();
     $download_filename = '';
     $download_url = '';
     foreach ($d_arr as $data) {
         if ($is_downloadable == 'Yes') {
             $download_filename = preg_replace('/[^0-9a-z\\.\\_\\-]/i', '', $data['title']);
             if (empty($download_filename)) {
                 $download_filename = md5($p_id);
             }
             $download_url = \URL::action('Agriya\\Webshoppack\\AdminProductAddController@getProductActions') . '?action=download_file&product_id=' . $p_id;
         }
         $product_preview_url = '';
         if ($data['resource_type'] == 'Audio' || $data['resource_type'] == 'Video') {
             $product_preview_url = '';
         }
         $resources_arr[] = array('resource_id' => $data['id'], 'resource_type' => $data['resource_type'], 'filename_thumb' => $data['filename'] . 'T.' . $data['ext'], 'filename_large' => $data['filename'] . 'L.' . $data['ext'], 'filename_original' => $data['filename'] . '.' . $data['ext'], 'download_filename' => $download_filename . '.' . $data['ext'], 'download_url' => $download_url, 'width' => $data['width'], 'height' => $data['height'], 't_width' => $data['t_width'], 't_height' => $data['t_height'], 'l_width' => $data['l_width'], 'l_height' => $data['l_height'], 'ext' => $data['ext'], 'title' => $data['title'], 'is_downloadable' => $data['is_downloadable'], 'product_preview_url' => $product_preview_url);
     }
     return $resources_arr;
 }
 /**
  * Process the form request
  *
  * @return void
  */
 public function formProcessor()
 {
     $result = Input::only(['user']);
     // The validation rules
     $rules = ['user' => ['required', 'regex:/^[a-z]([a-z0-9_-]){1,14}$/i']];
     $messages = ['user.required' => 'Your Last.fm username is required', 'user.regex' => 'Your Last.fm username contains invalid characters', 'user.min' => 'Your Last.fm username is too short', 'user.max' => 'Your Last.fm username is too long'];
     $validator = Validator::make($result, $rules, $messages);
     if ($validator->passes()) {
         $this->username = $result['user'];
     } else {
         return Redirect::to('/generator')->withInput()->withErrors($validator);
     }
     $string = '';
     for ($i = 1; $i <= 10; $i++) {
         $newLine = $i < 10 ? "\n\n" : '';
         $string .= '[url=' . URL::action('LastfmController@leader', ['user' => $this->username, 'num' => $i, 'type' => 'link']) . '][img]' . URL::action('LastfmController@leader', ['user' => $this->username, 'num' => $i]) . '[/img][/url]' . $newLine;
     }
     return View::make('form')->with('dataString', $string);
 }
예제 #27
0
 public function postDeletePost($id)
 {
     try {
         $post = Post::findOrFail($id);
         if ($post->created_by != Auth::id()) {
             return View::make('error.Unauthorized');
         }
         $post->delete();
         return Redirect::to(URL::action('BlogController@getPosts', array('username' => Auth::user()->username)));
     } catch (Exception $e) {
         throw $e;
     }
 }
예제 #28
0
<?php

$items = $class::where('username', 'like', "%{$pattern}%")->orWhere('mobile', 'like', "%{$pattern}%")->orWhere('email', 'like', "%{$pattern}%")->paginate(20);
foreach ($items as $item) {
    $item->_modal_field = $field;
}
$table = new KTable();
$table->th('姓名')->functional(function ($user) {
    return e($user->username);
})->th('邮件')->functional(function ($user) {
    return e($user->email);
})->th('手机')->functional(function ($user) {
    return e($user->mobile);
})->th('选择')->functional(function ($user) use($action) {
    $url = URL::action($action);
    $token = Session::getToken();
    $btn = <<<BTN
        <a class="btn btn-sm btn-success" onclick="javascript:modal_select_this_one_btn(this)" data-attr-id="{$user->id}" data-attr-url="{$url}" data-csrf-token="{$token}" href="javascript:;"><span class="glyphicon glyphicon-plus"></span></a>
BTN;
    return $btn;
});
$table->itemsToTbody($items);
echo $table->draw();
예제 #29
0
 public function testUserControllerStoreBadCSRFTokenAsAdmin()
 {
     $this->setExpectedException('Illuminate\\Session\\TokenMismatchException');
     $this->beAdmin();
     $this->call('post', URL::action('UserController@store'));
 }
예제 #30
0
 public function getUrl()
 {
     return \URL::action('Fbf\\LaravelTestimonials\\TestimonialsController@view', array('slug' => $this->slug));
 }