laravel-4

Laravel 4 Blade Form Formatting (Hidden Input)

核能气质少年 提交于 2019-12-31 07:24:05
问题 I have an "artist" resource, and on the show route page I have a form. I am using Laravel Blade syntax. As part of this form, I am trying to send the page ID to the back end of a Laravel 4 project. I am doing it this way: {{Form::hidden('artist-id',null, array( 'id' => '{{$artist->id}}', ));}} However, when using this, the browser throws an error, because it is not rendering the $artist->id variable within the brackets before the outside brackets of the input form. Is there a way around this

Laravel 4 eloquent models chaining additional where clauses

江枫思渺然 提交于 2019-12-31 04:53:05
问题 I Have the following code (member is just a standard Eloquent model) $members = new Member; $members->where('user_id', '=', 5); $_members = $members->get(); The last query run produces " SELECT * from members ", so it seems to be ignoring my where clause, what am I doing wrong here? By the way I know I could do $members = new Member::where(...) etc... but I will be adding the where clauses in a loop in order to create filtering on the results from the database. UPDATE The only way around this

Laravel Raw DB Insert Affected Rows

本秂侑毒 提交于 2019-12-31 04:42:17
问题 I'm using raw queries with laravel 4 , is there a way to check affected rows on an insert? DB::getPdo()->rowCount(); gives me an "undefined method" error . Code is as follows: $query = "INSERT IGNORE INTO table (id) VALUES (?)"; $doQuery = DB::insert($query, array($value)); if ($doQuery) { return DB::getPdo()->last(); } else { return 0; } If not, is there an easy way to figure out whether an insert was done or not without making it two queries? 回答1: You can use this function: int

Best practice for Laravel 4 + Zurb Foundation 5?

大兔子大兔子 提交于 2019-12-30 17:36:06
问题 TL;DR: what is the best way to arrange files, package managers and build tools for Laravel 4 + Zurb Foundation 5 combo (with Compass) as one consistent repository with clean public (static) section? I wanted to start a fresh project, based on latest Laravel on the backend side and using Foundation for the frontend. I am new to both of these and apparently I missed some of the tooling that was developed meanwhile when I wasn't doing PHP for some time. My confusion: Laravel uses Composer for

SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias on relationship

百般思念 提交于 2019-12-30 17:29:09
问题 So, I'm receiving the following error from Laravel framework; but I couldn't find why this framework is producing this error: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'participants' (SQL: select `participants`.*, `participants`.`message_id` as `pivot_message_id`, `participants`.`user_id` as `pivot_user_id`, `participants`.`created_at` as `pivot_created_at`, `participants`.`updated_at` as `pivot_updated_at` from `participants` inner join `participants` on

Symfony2 like database creation command in laravel console?

若如初见. 提交于 2019-12-30 13:40:29
问题 I have used symfony2 console to create database. If I want to create a database named "symfony" I usually mentioned that name in parameters.yml file and run the below command in console php app/console doctrine:database:create But when came to laravel, I don't find similar command to create database in laravel. Can anyone help me to find out those command to create database directly from Laravel Console . 回答1: You can do that but you will have to create your own command. First, run php

return inside foreach php and laravel

时光毁灭记忆、已成空白 提交于 2019-12-30 11:08:49
问题 I trying to return data every time inside the foreach() but i keep on getting the data on the first iteration of the loop here is my code for ($i = 0 ;$i<4;$i++) { var_dump($i); $publisher = Publisher::find($results[$i]->publisherId); //pr($publisher); $channels =$publisher->channels()->get() ; pr($channels[0]); $data = ReviveAgent::getPublisherDailyStatistics($channels[0],$start,$end); pr($data); return Response::json($data); } on the var_dump($i); It only shows data for the first 0 only.So

return inside foreach php and laravel

爱⌒轻易说出口 提交于 2019-12-30 11:08:27
问题 I trying to return data every time inside the foreach() but i keep on getting the data on the first iteration of the loop here is my code for ($i = 0 ;$i<4;$i++) { var_dump($i); $publisher = Publisher::find($results[$i]->publisherId); //pr($publisher); $channels =$publisher->channels()->get() ; pr($channels[0]); $data = ReviveAgent::getPublisherDailyStatistics($channels[0],$start,$end); pr($data); return Response::json($data); } on the var_dump($i); It only shows data for the first 0 only.So

deploy laravel 4 app in a subdomain

こ雲淡風輕ζ 提交于 2019-12-30 11:04:40
问题 I'm about to deploy laravel 4 on a shared web host into a subdomain and I'm a bit confused about what to do. I got it working on a hostpapa account but wasnt happy with the configuration and switched providers for the testing environment. I've created the following folders: domain/private/myApps/golfmanager I've placed in here all the files and folders except the public folder I've then placed the contents of the public folder into this folder: domain/subdomains/golfmanager/httpddocs I'm not

Executing a Route (Controller/Action) using PHP CLI and Detecting a CLI Request

陌路散爱 提交于 2019-12-30 10:16:09
问题 Is there a way in Laravel 4 to run my controller/action using PHP-CLI? I have a controller/action that I would like to extend to perform an alternative action if the request comes from the CLI, so is there a way to identify the request as a CLI request? The Laravel documentation on this site seems to suggest that there is a method Request::cli() for determining if the current request is via the Artisan CLI but when I used the method in Laravel 4, it throws an error: Call to undefined method