laravel-4

Laravel Exception after page is refresh - OpenSSL extension is required

烈酒焚心 提交于 2019-12-10 10:43:12
问题 I am newbie in Laravel. I am using windows 7. I have downloaded and created a laravel project inside xampp inside htdocs folder.I have uncommented the statement, extension=php_openssl.dll inside php.ini . When I type the http://localhost/laravel/public/ in the browser, it shows the home page. When I refresh the page I get an exception like this. When I remove the cookies and session variables in the browser settings, it will show the home page for once and if I refresh the page after,it shows

Linking asset files to views in Laravel4

你离开我真会死。 提交于 2019-12-10 10:42:33
问题 Hi I am newbie learning laravel 4 for creating an application. I am trying to link twitter bootstrap3 files to views using laravel blades. I installed a new laravel application folder. To remove public from url path i removed all the file in public folder and kept outside of public folder. I changed paths as per the above changes in index.php file.As per my needs i will have two sections in my application one is for users and another is for admin. So for this i changed my routes.php file like

Laravel/PHP - returning/redirecting from child class

…衆ロ難τιáo~ 提交于 2019-12-10 10:41:28
问题 This is my child controller: class VolunteersController extends \BaseController { public function index() { $this->checkForRoles(['admin']); //list some secret stuff for admin } } In my base controller I did this: class BaseController extends Controller { protected function checkForRoles($roles) { foreach ($roles as $role) { if (!(Auth::user()->hasRole($role))) { return Redirect::to('/'); } } } } Now what I expected was that the line return Redirect::to('/'); in BaseController would redirect

Laravel 4 with bootstrap-datepicker

泪湿孤枕 提交于 2019-12-10 10:25:28
问题 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>

Querying on related models using Laravel 4 and Eloquent

落花浮王杯 提交于 2019-12-10 10:13:38
问题 Using Laravel 4 I have the following models and relations: Event which hasMany Record which hasMany Item. What I would like to do is something like this Item::where('events.event_type_id', 2)->paginate(50); This of cause doesn't work as Eloquent doesn't JOIN the models together when retrieving the records. So how do I go about this without just writing the SQL myself (which I would like to avoid as I want to use pagination). 回答1: What you want is eager loading. It works like this if you want

Laravel Composer Update Error - Permission Denied

泪湿孤枕 提交于 2019-12-10 09:37:56
问题 I'm having error during updating composer. It's a Laravel 4 project which I've downloaded from .... and first time I updated it, it was fine and got updated. but due some reason I deleted that replace it with a fresh copy of that project, but now when I started to update it, it gives me the following error: [ErrorException] copy(/home/username/.composer/cache/files/symfony/security-core/3a27d7b34ee6 2cb0fdf5ad970e7777912ef4722f.zip): failed to open stream: Permission denied In between first

laravel validate multiple models

♀尐吖头ヾ 提交于 2019-12-10 07:40:15
问题 I would like a best practice for this kind of problem I have items , categories and category_item table for a many to many relationship I have 2 models with these validations rules class Category extends Basemodel { public static $rules = array( 'name' => 'required|min:2|max:255' ); .... class Item extends BaseModel { public static $rules = array( 'title' => 'required|min:5|max:255', 'content' => 'required' ); .... class Basemodel extends Eloquent{ public static function validate($data){

Laravel 4 always returns HTTP status code 200

醉酒当歌 提交于 2019-12-10 07:16:22
问题 I have below code in error.php, which is triggered using App::abort(404, $error) in my controller. Still my response status code is 200(ok). I tried with various error codes like 400, 403 // NotFoundException handler App::error(function(NotFoundException $e) { $default_message = 'The requested resource was not found'; return Response::json(array( 'error' => $e->getMessage() ?: $default_message, ), 404); }); 回答1: For anyone still googling this problem: I was struggling with this problem for

Could not scan for classes inside / IlluminateQueueClosure.php

怎甘沉沦 提交于 2019-12-10 05:02:32
问题 Whenever I'm trying to composer update or delete vendor directory + composer install I am getting this error message: [RuntimeException] Could not scan for classes inside "C:\Users\Mateusz\Documents\NetBeansProje cts\projectname\trunk\newproject\vendor/symfony/finder/Symfony/Component/Find er/src/Illuminate/Queue/IlluminateQueueClosure.php" which does not appear t o be a file nor a folder Well, actually I dont have this file in my project at all. Inside of /Finder directory there is no /src .

load form in bootstrap modal dynamically using laravel

依然范特西╮ 提交于 2019-12-10 04:35:56
问题 I am working on app, which required a form in bootstrap modal and also load the form dynamically. i am facing the problem all of the page is loaded in modal again. Anybody here provide any example for this..? // Controller public function loadJsModalForm() { return View::make('frmModals.frmProject'); } // index.blade @section('Modal') <!-- Modal --> <div class="modal fade" id="ProjectModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog