laravel-4

Basset/Assetic + SASS wont compile imports (osx)

浪子不回头ぞ 提交于 2019-12-11 12:07:23
问题 I am using Basset which in turn uses assetic for code minification and concatenation. I have the latest sass installed, using sass -v tells me it is 3.2.12 I have a css>sass folder and inside that a partials folder. The main.scss imports 2 files from the partials folder. One for variables (colours, widths etc) and the other for layout. The partials begine with an underscore, so they should not be compiled (_variables.scss) . The main.scss looks like this: @import "partials/variables"; @import

Laravel routing: how to pass parameter/arguments from one controller to controller

断了今生、忘了曾经 提交于 2019-12-11 11:47:32
问题 I have two controller and one controller calls another. I finish some processing on Controller 1 and want to pass the data to controller 2 for further processing. Controller 1: public function processData() { $paymenttypeid = “123”; $transid = “124”; return Redirect::action('Controller2@getData'); } Controller 2: public function getData($paymenttypeid, $transid ) { } Error: Missing argument 1 for Controller2::getData() How do I pass arguments from Controller 1 to Controller 2 ? 回答1: That is

Convert mysql query logic to Laravel query builder

半城伤御伤魂 提交于 2019-12-11 11:42:24
问题 I am trying to convert my mysql query logic to Laravel query builder. I I have no Idea how to convert it as laravel query. my query logic is SELECT id,name, case when visibility_status = '1' then 'Visible' when visibility_status = '0' then 'Invisible' end as visibility_status FROM `flowers` generally I write a select query using query builder but cant implement above logic $result = DB::table('flowers') ->select('flowers.id as id', 'flowers.name as name', 'flowers.visibility_status as

Backbone pushState and Laravel 4 - Routes won't work

☆樱花仙子☆ 提交于 2019-12-11 11:33:19
问题 I've got a very simple setup of laravel 4 with 1 controller for trips. Now another simple setup of Backbone with a Router and routes to regular routes like trips , trips/create . I want to use pushState: true to have nice URL but I can't seem to get it to work. When I try to reach the URLs it sends me to the page served by the server with my json data. However, if I type: www.mysite.com/#trips I am "redirected" to www.mysite.com/trips and then my method for this specific route triggers. Here

How to execute MYSQL query in laravel?

爱⌒轻易说出口 提交于 2019-12-11 11:22:49
问题 I have one MYSQL query with me I want to execute this query in laravel. select d1.update_id from ( select update_id, count(update_id) as ct from updates_tags where tag_id in (67,33,86,55) group by update_id) as d1 where d1.ct=4 Please guide me how do i Do it easily. I have one reference with me.... It is not working $updateArray = DB::table('updates_tags') ->select('update_id', DB::raw('count(*) as update_id')) ->whereIn('tag_id',$jsontags) ->groupBy('update_id') ->having('update_id','='

Laravel, why can't I run a successful create table migration with a slightly different spelling of table name?

只谈情不闲聊 提交于 2019-12-11 11:21:50
问题 I'm attempting to run a migration in Laravel 4 but I keep getting the following error: [Illuminate\Database\QueryException] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ramen.categories ' doesn't exist (SQL: create table `categories` (`id` int unsigned not null auto_increment primary key) default character set utf8 collate utf8_unicode_ci) Oddly, if I change the table name from "categories" to "categoriez" the migration runs successfully. This is the command I used to create the

Laravel redirect to post method

孤街醉人 提交于 2019-12-11 11:09:43
问题 To stay basic I would like to create a bookmark app I have a simple bookmarklet javascript:location.href='http://zas.dev/add?url='+encodeURIComponent(location.href) I created a rest controller <?php use zas\Repositories\DbLinkRepository; class LinksController extends BaseController { protected $link; function __construct(DbLinkRepository $link) { $this->link=$link; // ... //$this->beforeFilter('auth.basic', array('except' => array('index', 'show', 'store'))); // ... } public function index()

Laravel: How to set the Primary Key and Foreign Key to string

余生长醉 提交于 2019-12-11 11:07:57
问题 I'm not using the auto increment for the id instead i'm using the 32 char unique id. So when i create a relationship and query, im getting a null because my FK expecting int my models class User extend Eloquent { public $incrementing = false; } class Reservation extend Eloquent { public $incrementing = false; } so when i query this $reservations = Reservation::with('user')->where('user_id', '=', '22beb4892ba944c8b1895855e1d4d1ad')->get(); i could not retrieve the users information but the

Session variable on refresh

我的梦境 提交于 2019-12-11 10:49:45
问题 I have laravel controller like this: public function postSessionTopic() { $article_id = Input::get('article_id', 0); $comment_id = Input::get('comment_id', 0); \Session::set('page_topic_id', $article_id); \Session::set('page_comment_id', $comment_id); \\comment - I have tried \Session::put too, but that doesn't change anything } I use it, when user click on a article. I print_r out my session variable in this controller and everything looks fine. But after that I refresh my page, and there I

Custom Validate Phone numbers in Laravel 4.2

左心房为你撑大大i 提交于 2019-12-11 10:38:23
问题 I want to validate phone numbers using a custom made Validation Class in Laravel 4.2. Here is my code: class PhoneValidationRule extends \Illuminate\Validation\Validator { public function validatePhone($attribute, $value, $parameters) { return preg_match("/^\+\d[0-9]{11}", $value); } } // Register your custom validation rule Validator::resolver(function($translator, $data, $rules, $messages) { return new PhoneValidationRule($translator, $data, $rules, $messages); }); I want to accept phone