/** * Generates social login links based on what is enabled * * @return string */ public function getSocialLinks() { $socialite_enable = []; $socialite_links = ''; if (strlen(getenv('BITBUCKET_CLIENT_ID'))) { $socialite_enable[] = link_to_route('frontend.auth.social.login', trans('labels.frontend.auth.login_with', ['social_media' => 'Bit Bucket']), 'bitbucket'); } if (strlen(getenv('FACEBOOK_CLIENT_ID'))) { $socialite_enable[] = link_to_route('frontend.auth.social.login', trans('labels.frontend.auth.login_with', ['social_media' => 'Facebook']), 'facebook'); } if (strlen(getenv('GOOGLE_CLIENT_ID'))) { $socialite_enable[] = link_to_route('frontend.auth.social.login', trans('labels.frontend.auth.login_with', ['social_media' => 'Google']), 'google'); } if (strlen(getenv('GITHUB_CLIENT_ID'))) { $socialite_enable[] = link_to_route('frontend.auth.social.login', trans('labels.frontend.auth.login_with', ['social_media' => 'Github']), 'github'); } if (strlen(getenv('LINKEDIN_CLIENT_ID'))) { $socialite_enable[] = link_to_route('frontend.auth.social.login', trans('labels.frontend.auth.login_with', ['social_media' => 'Linked In']), 'linkedin'); } if (strlen(getenv('TWITTER_CLIENT_ID'))) { $socialite_enable[] = link_to_route('frontend.auth.social.login', trans('labels.frontend.auth.login_with', ['social_media' => 'Twitter']), 'twitter'); } for ($i = 0; $i < count($socialite_enable); $i++) { $socialite_links .= ($socialite_links != '' ? ' | ' : '') . $socialite_enable[$i]; } return $socialite_links; }
/** * Returns a new table of all stocks of the specified inventory item. * * @param Inventory $item * * @return \Orchestra\Contracts\Html\Builder */ public function table(Inventory $item) { $stocks = $item->stocks(); return $this->table->of('inventory.stocks', function (TableGrid $table) use($item, $stocks) { $table->with($stocks); $table->attributes(['class' => 'table table-hover table-striped']); $table->column('quantity'); $table->column('location', function (Column $column) use($item) { $column->value = function (InventoryStock $stock) use($item) { $name = $stock->location->trail; return link_to_route('maintenance.inventory.stocks.show', $name, [$item->getKey(), $stock->getKey()]); }; }); $table->column('last_movement', function (Column $column) { $column->value = function (InventoryStock $stock) { return $stock->last_movement; }; }); $table->column('last_movement_by', function (Column $column) { $column->value = function (InventoryStock $stock) { return $stock->last_movement_by; }; }); }); }
/** * * @return string */ public function link() { if (Auth::user()->hasPermission(Permission::PERMISSION_VIEW_UCIONICA)) { return link_to_route('Ucionica.show', $this->naziv, array('id' => $this->id)); } return $this->naziv; }
/** * Returns a new table of inquiry categories. * * @param \Illuminate\Database\Eloquent\Builder|Category $category * @param Inquiry $inquiry * * @return \Orchestra\Contracts\Html\Builder */ public function table($category, Inquiry $inquiry) { if ($category->exists) { // If the category exists we're looking to display it's children. $category = $category->children(); } else { // Otherwise we're displaying root nodes. $category = $category->whereIsRoot()->whereBelongsTo($inquiry->getTable()); } return $this->table->of('inquiries.categories', function (TableGrid $table) use($category) { $table->with($category)->paginate($this->perPage); $table->layout('pages.categories._table'); $table->column('name', function (Column $column) { $column->value = function (Category $category) { return link_to_route('inquiries.categories.index', $category->name, [$category->id]); }; }); $table->column('sub-categories', function (Column $column) { $column->value = function (Category $category) { return $category->children()->count(); }; }); $table->column('delete', function (Column $column) { $column->value = function (Category $category) { $route = 'inquiries.categories.destroy'; return link_to_route($route, 'Delete', [$category->id], ['data-post' => 'DELETE', 'data-title' => 'Delete Category?', 'data-message' => 'Are you sure you want to delete this category? All child categories will be destroyed.', 'class' => 'btn btn-xs btn-danger']); }; }); }); }
/** * Returns a new table of all computer types. * * @param ComputerType $type * * @return \Orchestra\Contracts\Html\Builder */ public function table(ComputerType $type) { return $this->table->of('computers.types', function (TableGrid $table) use($type) { $table->with($type)->paginate($this->perPage); $table->column('name'); $table->column('created_at_human', function (Column $column) { $column->label = 'Created'; $column->headers = ['class' => 'hidden-xs']; $column->attributes = function () { return ['class' => 'hidden-xs']; }; }); $table->column('edit', function (Column $column) { $column->label = 'Edit'; $column->value = function (ComputerType $type) { return link_to_route('computer-types.edit', 'Edit', [$type->id], ['class' => 'btn btn-xs btn-warning']); }; }); $table->column('delete', function (Column $column) { $column->label = 'Delete'; $column->value = function (ComputerType $type) { return link_to_route('computer-types.destroy', 'Delete', [$type->id], ['data-post' => 'DELETE', 'data-title' => 'Are you sure?', 'data-message' => 'Are you sure you want to delete this computer type?', 'class' => 'btn btn-xs btn-danger']); }; }); }); }
function recurse_pages($pages, $spaces = 0, $layoutsBlocks = [], $pageWidgets = [], $pagesWidgets = []) { $data = ''; foreach ($pages as $page) { // Блок $currentBlock = array_get($pageWidgets, $page['id'] . '.0'); $currentPosition = array_get($pageWidgets, $page['id'] . '.1'); $data .= '<tr data-id="' . $page['id'] . '" data-parent-id="' . $page['parent_id'] . '">'; $data .= '<td>'; if (!empty($page['childs'])) { $data .= '<div class="input-group">'; } $data .= Form::select('blocks[' . $page['id'] . '][block]', [], $currentBlock, ['class' => 'widget-blocks form-control', 'data-layout' => $page['layout_file'], 'data-value' => $currentBlock]); if (!empty($page['childs'])) { $data .= "<div class=\"input-group-btn\">" . Form::button(NULL, ['data-icon' => 'level-down', 'class' => 'set_to_inner_pages btn btn-warning', 'title' => trans('widgets::core.button.select_childs')]) . '</div></div>'; } $data .= '</td><td>'; $data .= Form::text('blocks[' . $page['id'] . '][position]', (int) $currentPosition, ['maxlength' => 4, 'size' => 4, 'class' => 'form-control text-right widget-position']); $data .= '</td><td></td>'; if (acl_check('page::edit')) { $data .= '<th>' . str_repeat("- ", $spaces) . link_to_route('backend.page.edit', $page['title'], [$page['id']]) . '</th>'; } else { $data .= '<th>' . str_repeat("- ", $spaces) . $page['title'] . '</th>'; } $data .= '</tr>'; if (!empty($page['childs'])) { $data .= recurse_pages($page['childs'], $spaces + 5, $layoutsBlocks, $pageWidgets, $pagesWidgets); } } return $data; }
public function show($userId = false, $goalId) { if ($userId) { if (!$this->currentUser->isStaff() and $this->currentUser->id != $userId) { if ($this->currentUser->plan) { return redirect()->route('plan', [$this->currentUser->id]); } return $this->unauthorized("You do not have permission to see development plans for other students."); } // Get the user $user = (!$this->currentUser->isStaff() and $this->currentUser->id == $userId) ? $this->currentUser : $this->usersRepo->find($userId); } else { // Get the user $user = $this->currentUser; // Set the userId $userId = $user->id; } // Load the plan and goals from the user object $user = $user->load('plan'); // Get the goal $goal = $this->goalsRepo->getById($goalId); if (!$goal) { return $this->errorNotFound("No such goal exists in your development plan. Please return to your " . link_to_route('plan', 'development plan', [$this->currentUser->id]) . " and try again."); } // Get the goal timeline $timeline = $this->goalsRepo->getUserGoalTimeline($user->plan, $goalId); return view('pages.devplans.goal', compact('goal', 'timeline', 'userId', 'user')); }
/** * Creates a new work order for the specified * request. * * @param string|int $requestId * * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse */ public function store($requestId) { $workRequest = $this->workRequest->find($requestId); /* * If a work order already exists for this request, we'll return * an error and let the user know */ if ($workRequest->workOrder) { $link = link_to_route('maintenance.work-orders.show', 'Show Work Order', [$workRequest->workOrder->id]); $this->message = "A work order already exists for this work request. {$link}"; $this->messageType = 'warning'; $this->redirect = routeBack('maintenance.work-requests.index'); return $this->response(); } $workOrder = $this->workOrder->createFromWorkRequest($workRequest); if ($workOrder) { $link = link_to_route('maintenance.work-orders.show', 'Show', [$workOrder->id]); $this->message = "Successfully generated work order. {$link}"; $this->messageType = 'success'; $this->redirect = routeBack('maintenance.work-orders.show', [$workOrder->id]); } else { $message = 'There was an issue trying to generate a work order for this request. If a work order was deleted that was attached to this request, it will have to be removed/recovered by an administrator before generating another work order.'; $this->message = $message; $this->messageType = 'danger'; $this->redirect = routeBack('maintenance.work-orders.requests.create', [$requestId]); } return $this->response(); }
/** * @return string */ public function userProfileLink() { $avatarSrc = $this->userAvatar(); $avatar = '<img class="img-circle space-right5 display-inline-block" style="max-width: 32px;" data-src="' . $avatarSrc . '">'; $name = is_null($this->entity->deleted_at) ? link_to_route('user.show', str_limit($this->entity->name, 25), [$this->entity->id]) : str_limit($this->entity->name, 25); return $avatar . ' ' . $name; }
/** * Returns a table of all inventory items. * * @param Inventory|\Illuminate\Database\Eloquent\Builder $item * * @return \Orchestra\Contracts\Html\Builder */ public function table($item) { return $this->table->of('inventory', function (TableGrid $table) use($item) { $table->with($item)->paginate($this->perPage); $table->attributes(['class' => 'table table-hover table-striped']); $table->column('ID', 'id'); $table->column('sku', function (Column $column) { $column->label = 'SKU'; $column->value = function (Inventory $item) { return $item->getSku(); }; }); $table->column('name', function (Column $column) { $column->value = function (Inventory $item) { return link_to_route('maintenance.inventory.show', $item->name, [$item->getKey()]); }; }); $table->column('category', function (Column $column) { $column->value = function (Inventory $item) { return $item->category->trail; }; }); $table->column('current_stock', function (Column $column) { $column->value = function (Inventory $item) { return $item->getTotalStock(); }; }); }); }
/** * Returns a new table of all operating systems. * * @param OperatingSystem $system * * @return \Orchestra\Contracts\Html\Builder */ public function table(OperatingSystem $system) { return $this->table->of('computers.operating-systems', function (TableGrid $table) use($system) { $table->with($system)->paginate($this->perPage); $table->column('name'); $table->column('version', function (Column $column) { $column->headers = ['class' => 'hidden-xs']; $column->attributes = function () { return ['class' => 'hidden-xs']; }; }); $table->column('service_pack', function (Column $column) { $column->headers = ['class' => 'hidden-xs']; $column->attributes = function () { return ['class' => 'hidden-xs']; }; }); $table->column('edit', function (Column $column) { $column->label = 'Edit'; $column->value = function (OperatingSystem $system) { return link_to_route('computer-systems.edit', 'Edit', [$system->id], ['class' => 'btn btn-xs btn-warning']); }; }); $table->column('delete', function (Column $column) { $column->label = 'Delete'; $column->value = function (OperatingSystem $system) { return link_to_route('computer-systems.destroy', 'Delete', [$system->id], ['data-post' => 'DELETE', 'data-title' => 'Are you sure?', 'data-message' => 'Are you sure you want to delete this operating system?', 'class' => 'btn btn-xs btn-danger']); }; }); }); }
/** * Execute the job. * * @return bool */ public function handle() { // Get the requested quantity to return $quantity = $this->request->input('quantity'); // We'll double check that the stock model we've been given contains // the pivot attribute, indicating it's been retrieved // from the work order. if ($this->stock->pivot instanceof Pivot) { if ($quantity > $this->stock->pivot->quantity) { // If the quantity entered is greater than the // taken stock, we'll return all of the stock. $returnQuantity = $this->stock->pivot->quantity; } else { // Otherwise we can use the users quantity input. $returnQuantity = $quantity; } // Set the stock put reason. $reason = link_to_route('maintenance.work-orders.show', 'Put Back from Work Order', [$this->workOrder->getKey()]); // Return the specified quantity. $this->stock->put($returnQuantity, $reason); // Retrieve the left over quantity for the work order. $newQuantity = $this->stock->pivot->quantity - $returnQuantity; if ($newQuantity == 0) { // If the new quantity is zero, we'll detach the // stock record from the work order parts. $this->workOrder->parts()->detach($this->stock->getKey()); } else { // Otherwise we'll update the quantity on the pivot record. $this->workOrder->parts()->updateExistingPivot($this->stock->getKey(), ['quantity' => $newQuantity]); } return true; } return false; }
function sort_projects_by($column, $body) { $direction = Request::get('direction') == 'asc' ? 'desc' : 'asc'; $search = Request::get('str') ? Request::get('str') : ''; $year = Request::get('year') ? Request::get('year') : ''; return link_to_route('projects', $body, ['sortBy' => $column, 'direction' => $direction, 'str' => $search, 'year' => $year]); }
/** * @return array */ public function getFunctions() { return [new Twig_SimpleFunction('user', [$this, 'getUserValue'], ['is_safe' => ['html']]), new Twig_SimpleFunction('user_input', function ($name) { return request($name, $this->getUserValue($name)); }), new Twig_SimpleFunction('link_to_profile', function () { $args = func_get_args(); if (is_array($args[0])) { $userId = isset($args['user_id']) ? $args['user_id'] : $args['id']; $name = isset($args['user_name']) ? $args['user_name'] : $args['name']; $isActive = $args['is_active']; $isBlocked = $args['is_blocked']; } else { $userId = array_shift($args); $name = array_shift($args); $isActive = array_shift($args); $isBlocked = array_shift($args); } $attributes = ['data-user-id' => $userId]; if ($isBlocked || !$isActive) { $attributes['class'] = 'del'; } return link_to_route('profile', $name, $userId, $attributes); }, ['is_safe' => ['html']]), new Twig_SimpleFunction('user_photo', function ($photo) { return $photo ? asset('storage/photo/' . $photo) : asset('img/avatar.png'); }), new Twig_SimpleFunction('can', function ($ability, $policy) { return Auth::guest() ? false : policy($policy)->{$ability}(auth()->user(), $policy); })]; }
function fa_link_to_route($route, $text, $icon = '', $params = array(), $attrs = array()) { if ($icon) { $text = '<i class="fa fa-' . $icon . '"></i> ' . $text; } return link_to_route($route, $text, $params, $attrs); }
/** * Returns a new table of all the specified work orders attachments. * * @param WorkOrder $workOrder * * @return \Orchestra\Contracts\Html\Builder */ public function table(WorkOrder $workOrder) { $attachments = $workOrder->attachments(); return $this->table->of('work-orders.attachments', function (TableGrid $table) use($workOrder, $attachments) { $table->with($attachments)->paginate($this->perPage); $table->column('type', function (Column $column) { $column->value = function (Attachment $attachment) { return $attachment->icon; }; }); $table->column('name', function (Column $column) use($workOrder) { $column->value = function (Attachment $attachment) use($workOrder) { $route = 'maintenance.work-orders.attachments.show'; $params = [$workOrder->getKey(), $attachment->getKey()]; return link_to_route($route, $attachment->name, $params); }; }); $table->column('uploaded_by', function (Column $column) { $column->value = function (Attachment $attachment) { if ($attachment->user instanceof User) { return $attachment->user->getRecipientName(); } }; }); $table->column('Uploaded On', 'created_at'); }); }
public function renderTicketTable(EloquentEngine $collection) { $collection->editColumn('subject', function ($ticket) { return link_to_route(Setting::grab('main_route') . '.show', $ticket->subject, $ticket->id); }); $collection->editColumn('status', function ($ticket) { $color = $ticket->color_status; $status = $ticket->status; return "<div style='color: {$color}'>{$status}</div>"; }); $collection->editColumn('priority', function ($ticket) { $color = $ticket->color_priority; $priority = $ticket->priority; return "<div style='color: {$color}'>{$priority}</div>"; }); $collection->editColumn('category', function ($ticket) { $color = $ticket->color_category; $category = $ticket->category; return "<div style='color: {$color}'>{$category}</div>"; }); $collection->editColumn('agent', function ($ticket) { $ticket = $this->tickets->find($ticket->id); return $ticket->agent->name; }); return $collection; }
/** * Returns a new table of all work orders. * * @param WorkOrder|Builder $workOrder * * @return \Orchestra\Contracts\Html\Builder */ public function table($workOrder) { return $this->table->of('work-orders', function (TableGrid $table) use($workOrder) { $table->with($workOrder)->paginate($this->perPage); $table->attributes(['class' => 'table table-hover table-striped']); $table->column('ID', 'id'); $table->column('subject', function (Column $column) { $column->value = function (WorkOrder $workOrder) { return link_to_route('maintenance.work-orders.show', $workOrder->subject, [$workOrder->getKey()]); }; }); $table->column('Created At', 'created_at'); $table->column('created_by', function (Column $column) { $column->value = function (WorkOrder $workOrder) { return $workOrder->user->fullname; }; }); $table->column('priority', function (Column $column) { $column->value = function (WorkOrder $workOrder) { if ($workOrder->priority instanceof Priority) { return $workOrder->priority->getLabel(); } return HTML::create('em', 'None'); }; }); $table->column('status', function (Column $column) { $column->value = function (WorkOrder $workOrder) { if ($workOrder->status instanceof Status) { return $workOrder->status->getLabel(); } return HTML::create('em', 'None'); }; }); }); }
public function subscribeProcess() { $rs = DB::select("SELECT status FROM subscribers WHERE email_address = ?", array(Input::get('subscribers_email'))); if (count($rs) == 0) { if (DB::table('subscribers')->insert(array('email_address' => Input::get('subscribers_email'), 'date_subscribed' => date('Y-m-d H:i:s')))) { Session::put('email_message', 'Thank you for subscribing please click here to verify: ' . link_to_route('verify_email', 'Verify email', array('email_address' => Input::get('subscribers_email')))); $data = array('message' => "Your Mradifund account has been created successfully awaiting approval. We will get back at you shortly on the same. Regards"); Mail::send('emails.notice', $data, function ($message) { $message->to(Input::get('subscribers_email'), Input::get('firstname') . ' ' . Input::get('lastname'))->subject('Mradi Account'); }); Session::flash('common_feedback', '<div class="alert alert-success" style="width: 500px;">Thank you for subscribing to our newsletter. Please check verify through your email</div>'); return View::make('common_feedback'); } else { Session::flash('common_feedback', '<div class="alert alert-warning" style="width: 500px;">Error subscribing. Please try again later</div>'); return View::make('common_feedback'); } } else { if ($rs[0]->status == 'INACTIVE') { DB::table('subscribers')->where('email_address', Input::get('subscribers_email'))->update(array('date_subscribed' => date('Y-m-d H:i:s'))); Session::put('email_message', 'Thank you for subscribing please click here to verify: ' . link_to_route('verify_email', 'Verify email', array('email_address' => Input::get('subscribers_email')))); $data = array('message' => "Your Mradifund account has been created successfully awaiting approval. We will get back at you shortly on the same. Regards"); Mail::send('emails.notice', $data, function ($message) { $message->to(Input::get('subscribers_email'), Input::get('firstname') . ' ' . Input::get('lastname'))->subject('Mradi Account'); }); Session::flash('common_feedback', '<div class="alert alert-success" style="width: 500px;">Thank you for subscribing to our newsletter. Please check verify through your email</div>'); return View::make('common_feedback'); } else { //Active Session::flash('common_feedback', '<div class="alert alert-success" style="width: 500px;">You have an active newsletter subscription. Thank you</div>'); return View::make('common_feedback'); } } }
/** * @return string */ public function getEditLInk() { $route = $this->getPrefix() . $this->getResourceName() . '.edit'; if ($this->hasRoute($route)) { return link_to_route($route, 'Edit', $this->id, ['class' => 'btn btn-xs btn-info']); } }
/** * Returns a new table of all computers. * * @param Computer $computer * * @return \Orchestra\Contracts\Html\Builder */ public function table(Computer $computer) { $computer = $computer->orderBy('name', 'asc'); return $this->table->of('computers', function (TableGrid $table) use($computer) { $table->with($computer)->paginate($this->perPage); $table->attributes('class', 'table table-hover'); $table->sortable(['name', 'description']); $table->searchable(['name', 'description']); $table->column('type', function (Column $column) { $column->label = 'Type'; $column->value = function (Computer $computer) { return $computer->type->name; }; }); $table->column('name', function ($column) { $column->label = 'Name'; $column->value = function (Computer $computer) { return link_to_route('computers.show', $computer->name, [$computer->id]); }; }); $table->column('description', function ($column) { $column->label = 'Description'; $column->value = function (Computer $computer) { return $computer->description; }; }); $table->column('os', function ($column) { $column->label = 'Operating System'; $column->value = function (Computer $computer) { return $computer->operating_system; }; }); }); }
/** * * @return stirng */ public function link() { if (Auth::user()->hasPermission(Permission::PERMISSION_VIEW_ROLE)) { return link_to_route('Role.show', $this->ime, array('id' => $this->id)); } return $this->ime; }
/** * Store a newly created resource in storage. * * @return Response */ public function validate() { if (Auth::attempt(['email' => Input::get('email'), 'password' => Input::get('password')], true)) { return Redirect::route('accounts.index')->with('message', 'Welcome, ' . Auth::user()->getFullName() . '!'); } Auth::logout(); return Redirect::back()->withInput()->with('message', 'User credentials failed. Please try again or ' . link_to_route('users.create', "SIGN UP.")); }
public function linkPlayerLastSeen() { $playerTotal = $this->wrappedObject->PlayerTotal(); if ($playerTotal == null || empty($playerTotal) || $playerTotal == "") { return "<i class='small'>Unknown</i>"; } return "<b>" . link_to_route('round-detail', $playerTotal->lastGame->created_at->diffForHumans(), [$playerTotal->last_game_id]) . "</b>"; }
/** @test */ public function it_reads_contacts_index() { $contactRequest = factory(\App\Gazette\Models\ContactRequest::class)->create(); $user = factory(\App\Gazette\Models\User::class)->create(); $user->assignRole(Role::administrator()); # Access through sidebar $this->actingAs($user)->visit(route('management.home'))->click('contact-requests-index')->seePageIs(route('management.contact-requests.index'))->see('All Contact Requests')->see('Name')->see($contactRequest->name)->see('Email')->see($contactRequest->email)->see('Phone Number')->see($contactRequest->phone_number)->see('Peek')->see(substr($contactRequest->message, 0, 23))->see('Viewed')->see('<i class="fa fa-eye-slash"></i>')->see('Actions')->see(link_to_route('management.contact-requests.show', 'Show', $contactRequest, ["class" => "btn btn-primary"]))->see('<form method="POST" action="' . route("management.contact-requests.destroy", $contactRequest) . '" accept-charset="UTF-8"><input name="_method" type="hidden" value="DELETE">'); }
/** * Return all the resources as JSON. * * @return Response */ public function json() { $contacts = Contact::where('user_id', '=', Auth::user()->id)->get(); foreach ($contacts as $contact) { $contact['editLink'] = link_to_route('contacts.edit', 'View / Edit', array($contact->id), array('class' => 'btn btn-warning dialog')); $contact['deleteLink'] = link_to_route('contacts.destroy', 'Delete', array($contact->id), array('class' => 'btn btn-danger deleteLink', 'data-token' => csrf_token())); } return response()->json($contacts, 200); }
public function index() { if (!$this->checkAccessRead()) { return; } $this->indexPage(['buttons' => null, 'tableHead' => [trans('app.id') => 'id', trans('contact::new') => 'new', trans('app.title') => 'title', trans('app.creator') => 'username', trans('app.created_at') => 'created_at'], 'tableRow' => function ($msg) { return [$msg->id, raw($msg->new ? HTML::fontIcon('envelope') : null), raw(link_to_route('admin.contact.show', $msg->title, [$msg->id])), $msg->username, $msg->created_at]; }, 'actions' => ['delete', 'restore']]); }
public static function link_to_sorting_action($col, $title = null) { if (is_null($title)) { $title = str_replace('_', ' ', $col); $title = ucfirst($title); } $indicator = Input::get('s') == $col ? Input::get('o') === 'asc' ? '↑' : '↓' : null; $parameters = array_merge(Route::getCurrentRoute()->parameters(), array('s' => $col, 'o' => Input::get('o') === 'asc' ? 'desc' : 'asc')); return link_to_route(Route::currentRouteName(), "{$title} {$indicator}", $parameters); }
/** @test */ public function it_reads_posts_edit() { $author = factory(User::class, 'user_author')->create(); factory(Post::class)->create(['published' => true]); $post = factory(Post::class)->create(['published' => true, 'author_id' => $author->id]); $this->actingAs($author)->visit(route('management.posts.edit', $post->slug))->see('<title>Edit Post · Gazette CMS</title>')->see('Meta')->see($post->title)->see($post->summary)->see($post->header_background)->seeIsSelected('category_id', "{$post->category->id}")->seeIsChecked('published')->see($post->content)->see('<input class="btn btn-flat btn-primary" type="submit" value="Update">')->see(link_to_route('posts.show', 'Show', $post->slug, ['class' => 'btn btn-sm bg-maroon btn-flat margin', 'target' => '_blank'])); factory(Post::class)->create(['published' => true]); $post = factory(Post::class)->create(['published' => false]); $this->actingAs($author)->visit(route('management.posts.edit', $post->slug))->dontSee(link_to_route('posts.show', 'Show', $post->slug, ['class' => 'btn btn-sm bg-maroon btn-flat margin'])); }
/** * Creates a new work order. * * @param Request $request * * @return \Illuminate\Http\RedirectResponse */ public function store(Request $request) { $workOrder = $this->workOrder->create($request); if ($workOrder) { $message = sprintf('Successfully created work order. %s', link_to_route('maintenance.work-orders.show', 'Show', [$workOrder->id])); return redirect()->route('maintenance.work-orders.index')->withSuccess($message); } else { $message = "There was an issue creating this work order. Please try again."; return redirect()->route('maintenance.work-orders.index')->withSuccess($message); } }