草庐IT

laravel-censor

全部标签

php - 在 Laravel 中测试 Controller 的正确方法是什么?

我正在重写现有的Laravel4应用程序以确保进行充分的测试。长话短说,我已经使用TDD方法重写了我的AccountController类,但我有点头疼。考虑以下呈现包含用户列表的页面的方法:publicfunctiongetIndex(){//buildtheview//return\View::make('account.list-users')->with('users',\Sentry::getUserProvider()->findAll());}我正在使用Smarty呈现我的View并使用Sentry进行身份验证。现在,我想写一些这样的测试:publicfunctionte

php - 在 Laravel 日志中记录 PHP 异常

我开始在Laravel4中为我的应用程序创建自定义日志功能,自定义消息一切正常,但是当我尝试在try..catch(Exception$e)中记录异常消息时>不会将此异常写入日志文件。pushHandler(newStreamHandler($logFile,Logger::INFO));break;case'Warn':$log->pushHandler(newStreamHandler($logFile,Logger::WARNING));break;case'Error':$log->pushHandler(newStreamHandler($logFile,Logger::ER

php - Laravel - 返回 SSH 输出

感谢您对此主题的兴趣。我是Laravel的新手,我有一个小问题。也许这很容易!我的Laravel中有一个SSH模块,它以这种方式工作:用户用Linux命令填充textarea元素。命令通过Ajax传递给位于“controllers”文件夹中的名为getExecute()的方法我希望此方法返回我的SSH服务器的完整响应,但这并没有发生。该方法唯一返回的是一个空格。例如:我传递命令“ls-la”,我的响应是Linux找到的所有文件夹,就像在终端上一样。有谁可以帮助我吗?这是我的代码:publicfunctiongetExecute(){if(\Request::ajax()):$ssh_c

php - laravel 队列守护进程邮件停止运行并出现 SSL 错误

我正在运行一个laravel队列守护进程,它根据所采取的操作发送邮件。这是通过主管运行以确保它始终运行。起初它工作正常,但一段时间后邮件停止发送。错误不是向上报告链,而是日志显示:[2014-07-3020:00:21]production.ERROR:exception'ErrorException'withmessage'fwrite():SSLoperationfailedwithcode1.OpenSSLErrormessages:error:1409F07F:SSLroutines:SSL3_WRITE_PENDING:badwriteretry'in/srv/www/exa

php - Laravel:外观实际上会在调用方法时创建新对象吗?

我有一个演示类通常通过$this->app->bind('demo',function(){returnnewDemo();}AnsetupafacadeprotectedstaticfunctiongetFacadeAccessor(){return'demo';}TheclassitselflookslikethisclassDemo{private$value1;private$value2;publicfunctionsetVal1($value){$this->value1=$value;}publicfunctionsetVal2($value){$this->value2

php - Laravel 与家园

我刚开始使用virtualbox和vagrant,现在我使用Homestead图像,一切都运行良好但是当我在虚拟机上创建名为laravel的项目时,它假设我在我的机器上看到了这个名为laravel的新文件夹,但我没有在我的机器上得到任何东西。当我输入urlhttp://homestead.app:8000/我得到此网页不可用同步不工作并且注意:-我使用的是ubuntu14.04这是我的homestead.yamlip:"192.168.10.10"memory:2048cpus:1authorize:~/.ssh/id_rsa.pub键:-~/.ssh/id_rsa文件夹:-map:/

php - 使用分页将散列附加到 Laravel 中的 url

我的路线:Route::get('/app/search',['as'=>'search','uses'=>'AppController@getSearch']);我的Controller:publicfunctiongetSearch(){$searchTerm=Input::get('s');$locs=Loc::whereRaw('match(title,description)against(?inbooleanmode)',[$searchTerm])->paginate(10);$locs->getFactory()->setViewName('pagination::sl

php - Laravel 登录(Auth::attempt)不工作

您好,我对Laravel有疑问。我无法登录。我尝试了所有在网上找到的方法。也许有人知道我在哪里犯了错误。创建新用户并发送电子邮件工作正常。登录我不知道像循环一样工作回来查看没有错误或任何消息。我在laravel中使用Debug模式,但没有显示任何错误。'required|email','username'=>'required'));if($validator->fails()){returnRedirect::route('account-sign-in')->withErrors($validator)->withInput();}else{if($auth=Auth::attem

php - Laravel 5.0 - 在哪里使用服务提供商的绑定(bind)?

在我的App\Providers\RouteServiceProvider中,我确实创建了方法register:publicfunctionregister(){$this->app->bindShared('JustTesting',function($app){die('gothere!');//returnnewMyClass;});}我应该在哪里使用它?我确实在App\Http\Controllers\HomeController中创建了一个方法:/***ReflectionExceptioninRouteDependencyResolverTrait.phpline53:*C

php - 在邮件功能 laravel 5 中添加标题

我正在将代码从laravel4更新到laravel5在laravel4中,邮件功能是通过如下代码实现的Mail::send('emailtemplate.sample',$content_data,function($message)use($to_mail,$email_data,$from_name){$message->from('admin@domain.com','admin')->to($to_mail)->subject($email_data->subject);$headers=$message->getHeaders();$headers->addTextHeade