laravel-4

How to handle User Registration via API Laravel

跟風遠走 提交于 2019-12-06 02:23:37
问题 I have being reading and watching some tutorials about API development in Laravel. I am new to API development entirely although I have used Laravel a bit. From all the tutorials I have gone through, they handled: login, get some data, update information, delete information, and even insert some information into the database. My problem is that none of this tutorials handle something like a user registration. Route::group(array('prefix' => 'api/v1', 'before' => 'auth.basic'), function() {

Laravel 4 - set database.fetch config at runtime

泪湿孤枕 提交于 2019-12-06 02:09:27
问题 In Laravel 3 I could set the database 'fetch' config at runtime (to get the results as an array rather than an object): Config::set('database.fetch', PDO::FETCH_ASSOC); In Laravel 4, the result is still being returned as an object. What am I doing wrong? [Edit - extra details] I decided to test if the config was being set, and also to try identical code segments in Laravel 3 and Laravel 4 side-by-side. //first fetch as object Config::set('database.fetch', PDO::FETCH_CLASS); //Laravel 3 and 4

Laravel 4 - unserialize(): Error at offset 0 of 32 bytes

不羁岁月 提交于 2019-12-06 01:59:44
问题 When I install Laravel 4, I receive this error: ErrorException unserialize(): Error at offset 0 of 32 bytes C:\xampp\htdocs\blog\laravel\bootstrap\compiled.php return unserialize($this->stripPadding($this->mcryptDecrypt($value, $iv))); If I modify return like this: return unserialize(base64_decode($this->stripPadding($this->mcryptDecrypt($value, $iv)))); Then the error goes away. But of course every time I run composer update this change will be undone. What could be the reason of this

Laravel 4 - How to use 'offset' in stead of 'page' with Eloquent's ->paginate()?

别等时光非礼了梦想. 提交于 2019-12-06 01:59:27
I am migrating an existing REST API to Laravel 4.1, and the API currently uses offset as querystring parameter to specify what the offset of the records needs to be. I would like to use the default Eloquent's paginate() , but these searches for the page querystring parameter. And of course it uses the page number (like 2) instead of the offset (like 200). Is there an easy way to configure the paginate function to this situation? Or do I need to use ->skip() and ->take() functions and make the links to the next page myself? @Anam: I want to use: $warehouses = Warehouse::orderBy('name') -

Laravel 4 with bootstrap-datepicker

不问归期 提交于 2019-12-06 01:38:41
I'm using Laravel PHP Framework with Bootstrap. I want to know how to insert a datepicker in to a form. I already have the bootstrap-datepicker installed but do not know how I will use. Here is the code of my form: {{ Form::open(array('action' => 'HomeController@postRegister')) }} <p>{{ Form::text('first_name', '', array('class' => 'form-control','placeholder' => 'primeiro nome')) }}</p> <p>{{ Form::text('last_name', '', array('class' => 'form-control','placeholder' => 'último nome')) }}</p> <p>{{ Form::text('email', '', array('class' => 'form-control','placeholder' => 'email')) }}</p> <p>{{

how to add PHPExcel library in laravel?

两盒软妹~` 提交于 2019-12-06 01:34:01
问题 i want to create new module in laravel which include PHPExcel library. where to put library. how to access it. i have put the PHPExcel library at below location laravel\project\application\libraries\PHPEXCEL it give me error PHP Fatal error: Class 'PHPExcel' not found. 回答1: You can use the PHPExcel Composer package. Just add "phpoffice/phpexcel": "dev-master" to your composer.json and enter composer update . This way the library will be "installed" and you can use it as normal (for example

Running beanstalkd worker on a remote server

扶醉桌前 提交于 2019-12-06 01:26:17
My stack set-up consists of the following Machine1 - Main Server (Running laravel) Machine2 - MySql Server for the laravel codebase Machine3 - Beanstalkd worker I have setup Supervisord on Machine1 and added the following queue listener [program:queue1] command=php artisan queue:listen --queue=queue1 --tries=2 ... My laravel queue config file(app/config/queue.php) reads the following 'beanstalkd' => array( 'driver' => 'beanstalkd', 'host' => '--- Machine3 IP ---', 'queue' => 'queue1', 'ttr' => 60, ), And I have installed beanstalkd on Machine3 along with Beanstalk console and can see my tasks

Laravel folder structures

走远了吗. 提交于 2019-12-06 01:01:01
问题 Often i come find it problematic when deciding where to place folders to resources within the app\ folder. Where should i place things such as model observers and validators and form macros and repositories .... currently i do the following \app \models \controllers \repositories \observers \interfaces \validators \views although i see some people do the following: \app \models \controllers \views \YourAppNameHere \Services \validators \... I do not understand the reason behind the \Acme

Laravel 4.1 Request::is for active menu not working

喜你入骨 提交于 2019-12-06 00:30:24
问题 I'm trying to make a menu active depending on route in laravel 4.1, my attempt: <li {{{ (Request::is('/core') ? 'class="active"' : '') }}}><a href="{{{ URL::to('/core') }}}">Control Panel</a> </li> My route: Route::get('/core', 'CoreController@Showindex'); This is not throwing any errors just simply ignored. any help is appreciated. 回答1: In Laravel 4.2: By name: <li class="{{ Route::is('user') ? 'active' : ''}}">Profile</li> router.php Route::get('/user/{id}', ['as' => 'user', 'uses' =>

Laravel 4 Auth redirect always to login page? /login

删除回忆录丶 提交于 2019-12-06 00:17:30
问题 I am using laravel for my web application and in routes.php I have: // admin routes Route::group(array('before' => 'auth'), function() { Route::controller('admin', 'UsersController'); }); I want to protect and check if the person is logged in , but this code always redirect to "/login" i want it to redirect to "admin/login" , can this be done? 回答1: There is a default auth filter in the filters.php file, it should be like this: Route::filter('auth', function($route, $request) { if (Auth::guest