laravel-4

Catching an exception when creating a new SoapClient properly

不打扰是莪最后的温柔 提交于 2019-12-11 19:42:25
问题 I'm having a difficult time catching a SoapClient authentication issue. When my code executes, Laravel declares it's throwing an ErrorException but I can't seem to catch it no matter what code I use. I'm tagging Laravel in case there's some magic going on somewhere I don't know about because App::error() will trigger on this error still. try { $client = new SoapClient( $this->serviceUrl . $this->clients[$clientName], array( 'login' => $this->username, 'password' => $this->password,

jQuery UI Sortable with Laravel will not submit

送分小仙女□ 提交于 2019-12-11 19:29:51
问题 After a lot of trial and error I finally got a sortable list to allow you to drag and drop to resort, but I cannot get the list to save. My guess is that it is an issue with the JS portion of the code, because from what it looks like, the controller never gets called. And if I had something wrong with how I called the controller but it still attempted then Laravel would throw an error. The answer is probably really simple, but I don't know much about Jquery or Ajax so I couldn't spot the

How to validate against upload capacity using DropZone.js?

谁说我不能喝 提交于 2019-12-11 19:12:01
问题 I have a value stored in a database that holds the actual capacity (capacity size in Megabytes for uploaded files) for a user. I want to validate this before each file within a queue is uploaded, so the maximum capacity isn't surpassed. I'm using Laravel as a framework, and DropZone.js for the uploading and I want to validate against this maximum capacity using the Dropzone methods. 来源: https://stackoverflow.com/questions/29583625/how-to-validate-against-upload-capacity-using-dropzone-js

How to change the value of Auth::user() in Laravel 4

别等时光非礼了梦想. 提交于 2019-12-11 17:52:09
问题 Any way to change the user instance returned by Auth::user() , what I want is to eager load some relations with it, so i don't have to keep typing it every time: from Auth::user(); to Auth::user()->with('company')->first(); and every time I request the Auth::user() I get the Auth::user()->with('company')->first() returned. 回答1: One way of doing it is to edit your before filter ( app/filters.php ). App::before(function($request) { if (Auth::check()) { Auth::setUser(Auth::user()->with('company'

Using Blade (Laravel) properly, having problems having header in it's own file

这一生的挚爱 提交于 2019-12-11 17:49:52
问题 I thought I would split the header from my blade templates and have the header and footer included separately. It worked to put my header.blade.php in layouts/partials/, and then in the next template, it extends layouts.partials.header. It works, but the stylesheets and scripts are loaded after the content. How should it be organized in a way that runs fast and in the correct order? header.blade.php @section('header') <!DOCTYPE html> <html> <head> <title> @section('title') @show </title>

unable to call illuminate class from resque worker

丶灬走出姿态 提交于 2019-12-11 17:45:01
问题 I have just started using resque in my application, I have created a worker and can queue jobs up. I am having issues though using illuminate classes in my worker. below is the error i am seeing in the worker. PHP Fatal error: Class 'Redis' not found in path/to/worker Here is my worker class: class SvrRestart { public function setUp() { // ... Set up environment for this job } public function perform() { $instance = $this->args['instance']; Redis::del('restart:' . $instance); } public

Python Requests trying to post data to Laravel

半腔热情 提交于 2019-12-11 17:33:47
问题 I'm trying to send post data like login user using python requests But I got and error when login success from Laravel it like Laravel can't handle session for requests to use My code to send post data s=requests.Session() headers = {'User-Agent': 'Mozilla/5.0'} URL = 'http://test.dev/api/login' s.get(URL) csrftoken = s.cookies['csrf'] print csrftoken login_data = dict(username='test', password='testtest', _token=csrftoken) ra=s.post(URL, data=login_data, headers = headers) print ra.request

Laravel 4 : Default route for route group

ぐ巨炮叔叔 提交于 2019-12-11 17:14:51
问题 I try to handle the default route of a route group, I have this but it doesn't work. Route::group(array('prefix' => 'administrator'), function() { Route::get('/', 'AdminUserController@getLogin'); Route::controller('page', 'AdminPageController'); Route::controller('user', 'AdminUserController'); Route::controller('menu', 'AdminMenuController'); }); Does anyone know how to do that ? Thank you 回答1: Just figured out. You are missing a uses , and the second parameter should be an array. Route::get

How to get the <i> in laravel's links

﹥>﹥吖頭↗ 提交于 2019-12-11 17:01:57
问题 I'm trying to use the with laravel's links. My link looks like this {{ HTML::linkAction('admin\MenusController@edit', 'Edit', array(), array('class' => 'btn btn-primary', 'role' => 'button')) }} and I would like to have the icon with it. Something like this <button class="btn btn-primary"><i class="fa fa-edit "></i> Edit</button> 回答1: This should work {{ HTML::decode(HTML::linkAction('admin\MenusController@edit', 'Edit', array(), array('class' => 'btn btn-primary', 'role' => 'button'))) }}

Getting console output in Laravel

喜你入骨 提交于 2019-12-11 17:01:53
问题 I need to capture the output of a console command to be sent by email as well when requested. How can I do this? How do I get the output generated from the following $this->info() calls? $r = processData(); $this->info("\nSubmitted data:"); $this->info("SubmissionId: " . $r['submission_id']); $this->info("Status: " . $r['status']); 回答1: Decided to just replace the $this->info() calls with a simple echo command and output buffer control. Looks good enough in the console and catches the data