This was your problem. You have named your relation artists, but it should be artist. That's why it was looking for a column named artists_id. You should define your relations as follow as it looks to me it is a One to Many. In your Artists Model public function albums()...

You cant have blade variables within other variables - it doesnt work that way. You need to change your code to this: Mail::send('blank', array('msg' =>'Welcome '.e(Input::get('name')),'name'=>Input::get('name'),'confirmation_code' => $confirmation_code), function($message){ $message->to(Input::get('email'), Input::get('name'))->subject(' '); }); Or better yet - handle the message inside the view file itself, rather than passing it via...

I found a solution in this question and changed missing routes catching in Laravel to this one and everything is fine. App::missing(function ($exception) { return Redirect::to('/#/' . Request::path()); }); The problems were Angular in html5Mode need # as a prefix. Laravel was returning main page in subroutes including assets as...

Use a delegated event handler : $('#table').on('click', '.pay-btn', function(e) { dataTables inject and remove table rows to the DOM in order to show pages. Thats why your event handler not is working except from page #1. NB: Dont know what your <table> id is - replace #table with your id....

As per your requirement, I blieve you have to update your relation to Polymorphic Relations. and than to access other attributes try one of them method. $user->roles()->attach(1, ['expires' => $expires]); $user->roles()->sync([1 => ['expires' => true]]); User::find(1)->roles()->save($role, ['expires' => $expires]); If you still facing some dificulties to handle that requirement let...

Assuming the car_image consists of the images of the cars: In your Car model: public function images() { return $this->hasMany('CarImage'); } In your CarImage model: public function car() { return $this->belongsTo('Car'); } Now you can load the cars without images like so: return Car::doesntHave('images')->get(); Using: doesntHave....

Just lunch method on existing object: $data->splice(5, 0, [$firstProduct]); (don't rewrite the object itself) Additionaly, use brackets on added element: [$firstProduct] to prevent casting this element to an array and adding all its fields to collections instead of whole object....

A very convenient way is to use laravels console component. You can create a new command by issuing php artisan make:console And find it thereafter in your app/console directory. Make sure to enable the command in the Kernel.php file once created. Simply call your class or whatever you want to...

You are getting Forbidden Error because authorize() method of form request is returning false: The issue is this: $clinicId = $this->route('postUpdateAddress'); To access a route parameter value in Form Requests you could do this: $clinicId = \Route::input('id'); //to get the value of {id} so authorize() should look like this: public...

The problem was with email_campaign_id to be null because $data['campaign_id'] was null the correct foreign key was $data['email_campaign_id'] that's what stopped the process - I should have tested it before putting it in the queue after changing the code EmailCampaignRecord::create([ 'email_campaign_id' => $data['campaign_id'], 'mandrill_email_id' => $response[0]->_id, 'status' => $response[0]->status, 'to_email'...

While I was waiting for an answer ;), I still having problems with Eloquent methods. I cant use something as $user->books()->get() or ->attach() in a relation many to many users and books, also with User::with('books') I have the same problem Call to undefined method Illuminate\Database\Query\Builder::xxxx() My problem is becouse of...

If you see into /vendor/laravel/framework/src/Illuminate/Http/Request.php, /** * Get all of the input and files for the request. * * @return array */ public function all() { return array_replace_recursive($this->input(), $this->files->all()); } which contains both files and other inputs. Since CodeBright was started with laravel 3, ( http://goo.gl/NWltLh ), I suppose (but...

This was caused by the fact that when run as a daemon the app instance stays in memory perpetually, so any code changes (such as introducing log lines) won't be reflected. To fix this, execute php artisan queue:restart or simply click the restart icon in Forge (if using that) after...

You could create an extra module, like: angular.module('ReporterApp.Controllers', [ /* dependencies here */]) Then you can do .controller( ...etc...). Then inject this module in your 'main' module. That way you can have different files containing different controllers, all in the ReporterApp.Controllers module. A simple example: File 1: angular.module('ReporterApp.Controllers') .controller('myCtrl', ['$scope',...

ID of an element must be unique, since you are creating the elements in a loop use class. When using ID selector it will return only the first element with the said ID, so in your case the click handler is getting registered to only the first element <tbody> <?php...

What you are seeing is the raw response back from Guzzle and it needs to be formatted. A simple way is $response->getBody();. Think of this like a collection in Laravel. When you get the data back, it is in a collection with a bunch of extra data that may be...

Do you have good reason to believe that scandir on a directory with a large number of folders will actually slow you down? You can do your query like this: if(Input::has('field')){ $filenames = scandir('img/folders'); $query = Model::whereIn('id', $filenames)->get(); } Edit 1 You may find these links useful: PHP: scandir() is...

From PHP.net: Windows users must include the bundled php_fileinfo.dll DLL file in php.ini to enable this extension. Check your php.ini file to ensure the .dll file is listed. The line is probably there and looks like ;extension=php_fileinfo.dll so just remove the ;....

You want to look into polymorphic relations to solve this. You want to be able to comment on Posts and Comments. What I have done is set up a commentable trait and have the models I want to add comments to use it. This way if you ever want to...

One solution to this is creating an alternate form of the relationship that includes trashed records. public function dspsTrashed() { return $this->hasWhatever()->withTrashed(); } Then: $this->model->whereHas('dspsTrashed', ...); ...

You haven't declared any routes pointing to /admin/{username} . That's the reason it can't be found by laravel. Here is an example: In your route files Route::get('/admin/{username}', '[email protected]'); I strongly advice you to use named routes. They are a lot easier to manage, even if your application gets bigger. For...

As a rule of thumb, use var_dump to debug and see how your arrays look like at different places within your code. For example you can see what does $res look like inside the foreach loop in the view and see why you have any undefined indices. Overall your code...

Hi You can fetch this by this ways : Find Top 10 cities which have the maximum business: $city = City::with('business')->get()->sortBy(function($query) { return $query->business->count(); }, SORT_REGULAR, true) ->take(10); Find Business by city name. Business::whereHas('city', function ($q) { $q->where('name', 'like', 'search_string');//name is the city_name as per your attributes name })->get(); ...

You may create a section like the following in your view, for example: @extends('layouts.master') @section('styles') <link href="{{asset('assets/css/custom-style.css')}}" /> @stop Then also in your layout, @yield that, for example: <!--Static StyleSheets--> <link href="{{asset('assets/css/common-style.css')}}" /> <!--Dynamic StyleSheets added from a view would be pasted here--> @yield('styles') Same goes for script tags, for...

You can compile blade syntax string, stored in a DB row or a variable by extending Blade Compiler. Solution code taken from here, I have not tested the code myself. <?php namespace Laravel\Enhanced; use Illuminate\View\Compilers\BladeCompiler as LaraveBladeCompiler; class BladeCompiler extends LaraveBladeCompiler { /** * Compile blade template with passing arguments....

You can SELECT the date ORDER BY the amount of visitors DESCENDING and LIMIT by 1. This is basic mysql. How to use this in laravel, is in the documentation. Order by desc: ->orderBy('visits', 'desc') Limit: ->take(1) My example query is based on a system that has a column which...

When you define sections you can tell blade how and when to display them, you do that with the closing directives like @stop, @show, @overwrite etc. @stop means you define a section for later use(meaning it doesn't show) so it can be used or be overriden later by another. To...

You can count a relationship like this: $emails->mandrillemails()->whereMsgState('bounced')->count(); Since you're @foreaching things, you may want to eager load this data. This is a little more complex when you're doing counts on the relationship - see http://laravel.io/forum/05-03-2014-eloquent-get-count-relation and http://softonsofa.com/tweaking-eloquent-relations-how-to-get-hasmany-relation-count-efficiently/ for some possible techniques to eager-load the count value instead of the...

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);//This is line 50 the ::class is only supported since PHP 5.5 Also you must have mistakingly installed laravel 5.1+ because that's the only version to require php 5.5+...

You're moving the file in the wrong direction. It should be $move = File::move($old_path, $new_path); ... in other words, the first argument should be the OLD file location, the second argument should be the NEW file location... you have it backwards. :) From the Laravel Docs Move A File To...

You create new TD for each member. The nested foreach has to be: <td> @foreach($user as $mem) {{ $mem->name }}<br> @endforeach </td> The result will be: <td> Name 1<br> Name 2<br> Name 3<br> </td> I don't know the template engine you used, add inside a loop condition and don't put...

Dompdf's stream() method always sends to the browser. If you want to capture the output and save to a file you should use the output() method instead. $pdf = \App::make('dompdf'); $pdf->loadHTML('<h1>Hello World!!</h1>'); file_put_contents("order_email.pdf", $pdf->output()); ...