ERROR The hint here is ‘Collection‘… If somehow you got this error while you have check all code is ok, relationship is ok, then try to check either you use first() or get() method. Supposedly you use first() instead of get() method as get() method will return a collection() while first() just return a record.…
Framework
-
-
Download at http://www.cssscript.com/generic-country-state-dropdown-list-countries-js/ Create public/js directory and put all the .js file inside. Create public/css directory and put all the .css file inside. Add to the master blade head tags <script type=”text/javascript” src=”{{ asset(‘js/countries.js’) }}”></script> Add to the bottom of master body tags area <script language=”javascript”> populateCountries(“country”, “state”); // first parameter is id of country drop-down…
-
Add jquery css in your header (view) <link rel=”stylesheet” href=”//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css”> Add jquery js in yoyr footer (view – body tags) <script> $(function() { $( “#datepicker” ).datepicker(); }); </script> Edit your forms {!! Form::text(‘date’, ”, array(‘id’ => ‘datepicker’,’class’ => ‘form-control’)) !!} Reference: Laracast
-
We need to install http://laravelcollective.com. HTML: HTML helpers for creating common HTML and form elements Run composer require “laravelcollective/html”:”^5.2.0″ OR edit composer.json, Add “require”: { “php”: “>=5.5.9”, “laravel/framework”: “5.1.*”, “laravelcollective/html”: “5.1.*” }, Run composer update Edit config/app.php. Add to the provider array App\Providers\RouteServiceProvider::class, Collective\Html\HtmlServiceProvider::class, Add to the aliases array ‘View’ => Illuminate\Support\Facades\View::class, ‘Form’ => Collective\Html\FormFacade::class, ‘Html’…
-
Change .env [php] DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=bebasrokok01 DB_USERNAME=root DB_PASSWORD= [/php] config/database.php [php] ‘mysql’ => [ ‘driver’ => ‘mysql’, ‘host’ => env(‘DB_HOST’, ‘localhost’), ‘port’ => env(‘DB_PORT’, ‘3306’), ‘database’ => env(‘DB_DATABASE’, ‘bebasrokok01’), ‘username’ => env(‘DB_USERNAME’, ‘root’), ‘password’ => env(‘DB_PASSWORD’, ”), ‘charset’ => ‘utf8’, ‘collation’ => ‘utf8_unicode_ci’, ‘prefix’ => ”, ‘strict’ => false, ‘engine’ => null, ], [/php]…
-
This simple layout using basic Bootstrap CDN (http://getbootstrap.com) master.blade.php [php] <html> <head> <title> @yield(‘title’) </title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"> <script src="//code.jquery.com/jquery-1.11.3.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> </head> <body> @include(‘shared.navbar’) @yield(‘content’) </body> </html> [/php] navbar.blade.php [php] <nav class="navbar navbar-default"> <div class="container-fluid"> <!– Brand and toggle get grouped for better mobile display –> <div class="navbar-header"> <button type="button" class="navbar-toggle…