/** * Run the database seeds. * * @return void */ public function run() { $business = Business::find(1); $business->pages()->saveMany([new Page(['uri' => '', 'title' => 'Web Architech', 'content' => ' { "data": [ { "type": "text", "data": { "text": "Welcome to Web Architech. Building the internet, one site at a time." } }, { "type": "video", "data": { "source": "youtube", "remote_id": "FR7wOGyAzpw" } } ] }']), new Page(['uri' => 'contact', 'title' => 'Contact Us', 'content' => ' { "data": [ { "type": "text", "data": { "text": "Give me all your info" } } ] }'])]); }
/** * Run the database seeds. * * @return void */ public function run() { $business = Business::create(['name' => 'Web Architech', 'url' => 'webarchi.tech', 'address' => '6579 Ranchero Drive', 'city' => 'Salmon Arm', 'region' => 'BC', 'country' => 'Canada', 'code' => 'V1E 2R2', 'phone1' => '2503075535', 'phone2' => '2502999608', 'email' => '*****@*****.**', 'hours' => '{ "hours": { "Monday": { "9:00": "16:30" }, "Tuesday": { "9:00": "12:00", "13:00": "17:00" }, "Wednesday": { "9:00": "12:00", "12:30": "17:00", "19:00": "23:00" }, "Thursday": { "10:30": "13:00", "13:30": "17:30" }, "Friday": { "7:00": "14:30" } } }']); }
/** * Register any application services. * * @return void */ public function register() { //$this->app->instance('Business', Business::byURL(rtrim($app['request']->instance()->getBaseUrl(), '/'))); $this->app->singleton('Business', function ($app) { return Business::with(['pages'])->where('url', '=', $app['request']->getHost())->firstOrFail(); }); }
public static function findByURL($url) { return Business::where('url', '=', $url)->first(); }