laravel-4

Laravel 4.2 rewrite URL - remove public

 ̄綄美尐妖づ 提交于 2020-01-06 13:58:10
问题 My old domain: domain.com My laravel project in: domain.com/laravel/public It's working well, but I don't want see public in URL. I add new .htaccess file to my root laravel folder ( domain.com/laravel/.htaccess ) with: RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] When I access to domain.com/laravel , my jQuery path is: domain.com/js/jquery.min.js When I access to domain.com/laravel/public , my jQuery path is: domain.com/laravel/public/js/jquery.min.js I don't want move all files in

Laravel Raw query paginate; raw query to eloquent object

橙三吉。 提交于 2020-01-06 13:11:09
问题 select '0000-00-00' as date, 'Opening Balance' as narration, (SELECT debit FROM `account_sub_journal` where id=1)as debit, (SELECT credit FROM `account_sub_journal` where id=1)as credit, '0' as transaction_entry_id,'0' as account_sub_journal_id UNION SELECT * FROM `ledgertransactions` where account_sub_journal_id = 1 and `date` BETWEEN '2014-04-01' and '2014-04-10' I currently do this as a static function in model. I couldn't paginate this since laravel says it is not an object public static

Laravel Raw query paginate; raw query to eloquent object

╄→尐↘猪︶ㄣ 提交于 2020-01-06 13:10:39
问题 select '0000-00-00' as date, 'Opening Balance' as narration, (SELECT debit FROM `account_sub_journal` where id=1)as debit, (SELECT credit FROM `account_sub_journal` where id=1)as credit, '0' as transaction_entry_id,'0' as account_sub_journal_id UNION SELECT * FROM `ledgertransactions` where account_sub_journal_id = 1 and `date` BETWEEN '2014-04-01' and '2014-04-10' I currently do this as a static function in model. I couldn't paginate this since laravel says it is not an object public static

Laravel Raw query paginate; raw query to eloquent object

你。 提交于 2020-01-06 13:10:19
问题 select '0000-00-00' as date, 'Opening Balance' as narration, (SELECT debit FROM `account_sub_journal` where id=1)as debit, (SELECT credit FROM `account_sub_journal` where id=1)as credit, '0' as transaction_entry_id,'0' as account_sub_journal_id UNION SELECT * FROM `ledgertransactions` where account_sub_journal_id = 1 and `date` BETWEEN '2014-04-01' and '2014-04-10' I currently do this as a static function in model. I couldn't paginate this since laravel says it is not an object public static

Eloquent update and limit

我与影子孤独终老i 提交于 2020-01-06 12:26:04
问题 I could not figure out how can i use both update and limit methods in laravel eloquent orm. $affectedRows = Promo::where('used','=',0) ->update(array('user_id' => Auth::user()->id)) ->limit(1); // Call to a member function limit() on a non-object //->take(1); // Call to a member function take() on a non-object I tried both limit and take methods. I want to do only one result will be update. But i think, i can not use limit or take methods on update. Is there any way to update only one row via

Laravel 4.2 Storing image path to database

拟墨画扇 提交于 2020-01-06 08:49:15
问题 I'm having trouble to store the correct image path of a file upload to the database. this is my code: public function store() { $input = Input::all(); try { $this->modelForm->validate($input); if ( Input::hasFile('thumbnail')) { $file = Input::file('thumbnail'); $name = time().'-'.$file->getClientOriginalName(); $file = $file->move('uploads/', $name); $input['file'] = $file->getRealPath(); } $model = new Model($input); $model->save(); Redirect::back(); } catch (FormValidationException $e) {

Laravel: Passing custom URLs with both ID and slug to the view

醉酒当歌 提交于 2020-01-06 05:43:12
问题 My articles URL contains both ID and slug, in this format: /articles/ID/slug . Only ID is used for record lookup, the slug is just there for SEO and is not stored in the database. At the moment I am doing this in my view (inside a foreach loop): $url = URL::route('articles.show', array('id' => $article->id, 'slug' => Str::slug($article->title))); To generate the complete URL, e.g: articles/1/accusamus-quos-et-facilis-quia , but; I do not want to do this in the view. I want to do it in the

Using @ (at sign) in PHP Laravel strings

核能气质少年 提交于 2020-01-06 02:44:21
问题 I have the below code in my app. The problem is the @ (at sign). When it's there, I get syntax highlighting and errors as if the string doesn't end. When remove it, the page works fine (minus the action not existing). I've tried escaping the @ and that doesn't work. I've also tried double quotes, but that doesn't work either. How can I escape @? I could use the route function and avoid the @ entirely but I feel that the action function is far more clear in terms of what it's doing so I'd

cannot set post_max_size in laravel 4

空扰寡人 提交于 2020-01-05 12:09:18
问题 Details :- Stack : WAMP OS : Windows 7. I am using Laravel 4 and I know by using ini_set('post_max_size','40M'); we can manually set the php.ini post_max_size value. The index.php file inside laravel's public/ folder runs the first time the project is opened so I wrote ini_set('post_max_size','40M'); inside that public/index.php file and started the app once again but when i tried to see the value of post_max_size by using echo ini_get('post_max_size'); it shows 3M that is by default in the

Laravel Migration - Says unknown database, but it is created

北战南征 提交于 2020-01-05 12:09:11
问题 when I use php artisan migrate , i get the error SQLSTATE[42000] [1049] Unknown database 'databaseName' . But the database DOES exists! I even tried going back into terminal, logged into mysql and created the database again, and it said that database already exists! Why is this giving me this error? 回答1: In your app/config/database.php file change the default value from databaseName to a real database name that you are trying to use in your application, something like this (for mysql driver):