本文整理汇总了PHP中action函数的典型用法代码示例。如果您正苦于以下问题:PHP action函数的具体用法?PHP action怎么用?PHP action使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了action函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* 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: slots
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]));
}
}
示例3: upload
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);
}
}
示例4: update
/**
* 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'));
}
示例5: addProduct
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'));
}
}
示例6: update
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}));
}
示例7: __construct
/**
* 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;
}
示例8: postForm
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());
}
}
示例9: update
/**
* 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'));
}
示例10: recursia
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
}
示例11: getIndex
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>';
}
示例12: handle
/**
* 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);
}
示例13: handle
/**
* 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> ';
$hrefShow = action('GalleriesController@show', [$val]);
$iconUpdate = '<span class="fa fa-pencil"></span> ';
$hrefUpdate = action('GalleriesController@edit', [$val]);
$iconDelete = '<span class="fa fa-times"></span> ';
$hrefDelete = action('GalleriesController@delete', [$val]);
return '<a href="' . $hrefShow . '">' . $iconShow . '</a> ' . '<a href="' . $hrefUpdate . '">' . $iconUpdate . '</a> ' . '<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> ';
}
}), (new FieldConfig('reblog_posts'))->setLabel('RP')->setCallback(function ($val) {
if ($val) {
return '<span class="fa fa-check"></span> ';
}
}), (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);
}
示例14: checkIsLogin
/**
* 检测登录
*
* @return bool|\Illuminate\Http\RedirectResponse
* @author yangyifan <yangyifanphp@gmail.com>
*/
private function checkIsLogin()
{
load_func('common');
$uid = is_admn_login();
return $uid <= 0 && header('location:' . action('Admin\\LoginController@getIndex'));
die;
}
示例15: store
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'));
}