laravel-4

Composer not downloading src directory for packages

佐手、 提交于 2019-12-12 12:07:37
问题 I'm using Laravel and Composer to build a web app. On my local machine I have its requirements setup within the composer.json file and everything works as it should. I'm using Github to push to the production server, however, I then run composer install and add the providers and aliases for one of my packages, I then get an error saying that the service provider hasn't been found. I then proceeded to check the vendor folder, which had the directory in it for the package, but within this

Keep form values when redirect back in Laravel 4

China☆狼群 提交于 2019-12-12 11:51:15
问题 I'm trying to keep the values of a form when Redirect::back on Laravel 4, but I can't find a way to do this. This is my form: {{ Form::open(array('route' => 'generate', 'files' => true)) }} {{ Form::radio('myType', '1', true); }} {{ Form::label('myType', '1'); }} {{ Form::radio('myType', '2'); }} {{ Form::label('myType', '2'); }} {{ Form::radio('myType', '3'); }} {{ Form::label('myType', '3'); }} {{ Form::text('myName'); }} {{ Form::file('uploadImage'); }} {{ Form::submit('Go'); }} {{ Form:

How to add collate to laravel query

社会主义新天地 提交于 2019-12-12 11:18:28
问题 I need to run a query having collate utf8_bin like so: SELECT * FROM `table` WHERE `field`='value' collate utf8_bin; This is strictly for an admin script and I don't want to update the table charset itself, just for the particular query. Can I do this using the Eloquent ORM or do I need to write this query out? 回答1: Since you can configure MySQL driver to use one: 'mysql' => array( 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'database', 'username' => 'root', 'password' => '',

Laravel 4: protecting routes provided by a controller

血红的双手。 提交于 2019-12-12 11:08:15
问题 I'm building a Laravel 4 app and I want to protect my admin area so it is only accessible if the user is logged in/authenticated. What is the best way to do this? The Laravel docs say you can protect a route like this: Route::get('profile', array('before' => 'auth', function() { // Only authenticated users may enter... })); But what happens when my route looks like this: Route::resource('cms', 'PostsController'); How do I protect a route that is directing to a controller? Thanks in advance!

Laravel Querying Relations Model::has('relation') doesn't work

谁都会走 提交于 2019-12-12 10:56:24
问题 In the Laravel documentation it says you can use this syntax for querying an object relation to get only the Posts that have at least one Comment: $posts = Post::has('comments')->get(); I'm trying something similar where I want to fetch only objects that have at least one relation object. These are my two classes: class Movie extends Eloquent { protected $table = 'movie'; public function matches() { return $this->hasMany("Match"); } } class Match extends Eloquent { protected $table = 'match';

Incorrect integer value '' for a MySQL column that's integer and allow null?

为君一笑 提交于 2019-12-12 10:49:14
问题 I'm working on inserting a CSV into a table. I don't have any control over what's in the CSV and a lot of the fields are blank. In my very first record for instance, the field "baths_full" is just empty (two commas back to back). On my production server running MySQL 5.5.37, it inserts the record with the baths_full as an empty field. On my local machine running MySQL 5.6.19, it gives me the error: [Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 1366 Incorrect integer

Laravel - syntax error, unexpected end of file

只谈情不闲聊 提交于 2019-12-12 10:29:10
问题 I have a website which works fine on host, but I'm currently trying to install it on localhost. I've downloaded everything and configured to work on localhost - Database & URL. The problem is this error: Unhandled Exception Message: syntax error, unexpected end of file Location: C:\Program Files (x86)\EasyPHP-12.1\www\laravel\view.php(386) : eval()'d code on line 118 And I don't know what causes it. Any solutions? P.S. I've setup in my windows' host file 127.0.0.1 myproject.dev . 回答1: There

how to customize upload folder for ckeditor+kcfinder using in Laravel?

懵懂的女人 提交于 2019-12-12 10:26:02
问题 I am trying to upload photos by using kcfinder as a plugin for Ckeditor. When configuring kcfinder I use this config : CKEDITOR.editorConfig = function(config) { config.filebrowserBrowseUrl = '../../../../assets/kcfinder/browse.php?type=files'; config.filebrowserImageBrowseUrl = 'assets/kcfinder/browse.php?type=images'; config.filebrowserFlashBrowseUrl = 'assets/kcfinder/browse.php?type=flash'; config.filebrowserUploadUrl = '../../../../assets/kcfinder/upload.php?type=files'; config

Pagination in Laravel 4 works for one page. but not working for another

穿精又带淫゛_ 提交于 2019-12-12 10:23:55
问题 I downloaded the starter kit for laravel using sentry from GitHub. Everything is fine so far. Blog page has pagination. I am able to change the number of items per page as I like by changing the same pagination(x) value. Now problem is, i created a new page manually by myself called "Search" which displays results for Keywords searched. Here I added the same pagination, it shows the number of items per page as mentioned, page numbers, arrows. Everything is perfect, but when I click page 2 it

htmlentities() expects parameter 1 to be string, array given

佐手、 提交于 2019-12-12 09:54:24
问题 I'm trying to add a class to a laravel form. The array is being passed as the third argument, as required, but I get the above error. {{ Form::input('text', $variable->name, array('class' => 'form-control')) }} If I get rid of the third argument, the form displays as expected (unstyled). I can't see what I'm doing wrong here - can anyone help? 回答1: {{ Form::text('text', $variable->name, array('class' => 'form-control')) }} 回答2: I can see from the api that there is another argument expected: