laravel-5.4

How to format date receiving through Vuejs Datepicker in laravel

守給你的承諾、 提交于 2019-12-02 02:49:17
I'm building an application in Vuejs with Laravel as backend. I'm using datepicker to add dates in column. I'm getting an error of Invalid datetime format: 1292 Incorrect datetime value: '2017-05-04T18:30:00.000Z' for column 'schedule' at row 1 I'm sending the date in request: And while doing dd in laravel I'm getting: Can someone guide me how to achieve this. You could use Carbon to parse the date and format it accordingly $mydate = '2017-05-04T18:30:00.000Z'; // $request->schedule $parsed_date = Carbon\Carbon::parse($mydate)->toDateTimeString(); Maybe you could change your request date

Laravel Login with www. and without

╄→гoц情女王★ 提交于 2019-12-02 02:47:08
I have a Laravel 5.4 App I created on a Ubuntu 14.04 with NGINX and it runs fine on https://MyDomain.TLD and https://www.MyDomain.TLD The problem is: When I log in either(with or without www), it works fine but cookie informations are not shared to the other variant. I did not have an issue with this in previous versions of Laravel 5+ . Any pointers? You need to handle www because session is saving based on domain, so try adding below code into .htaccess file, one is for force redirection to www and one is to remove www. #Force www: RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com [NC]

Update data into table from dynamically created input field

别说谁变了你拦得住时间么 提交于 2019-12-01 23:55:43
I have 2 models Tour.php public function Itinerary() { return $this->hasMany('App\Itinerary', 'tour_id'); } and Itinerary.php public function tour() { return $this->belongsTo('App\Tour', 'tour_id'); } tours table: id|title|content itineraries table: id|tour_id|day|itinerary I have used vue js to create or add and remove input field for day and plan dynamically. And used the following code in tour.store method to insert into itineraries table: $count = count($request->input('day')); $temp_day = $request->input('day'); $temp_itinerary = $request->input('itinerary'); for($i = 0; $i < $count; ++$i

laravel 5.4,How to get logged in user data into controller

て烟熏妆下的殇ゞ 提交于 2019-12-01 22:51:47
Seems duplicate of : how to get current user id in laravel 5.4 I am working on laravel 5.4, i have used the auth for user login at client side,now i want the logged in user details at the Controller, view side by writing below code i got that: {{ Auth::user()->name }} // this works on view page only. Suggest me the library files with the code. I want to display some user data like name,age,dob,etc after logged in. The laravel Auth Facade is used to get the autheticated user data as $user = Auth::user(); print_r($user); This will work in your controller and view both, but you have to include it

Running Laravel Dusk on Headless (no GUI) machine

半世苍凉 提交于 2019-12-01 18:28:47
With the recent announcement of Laravel 5.4, I thought I'd give it a try. Like Ozymandias-X on Reddit, I also have been frustrated by it. My Setup Windows 10 as Host; CentOS 7 as Guest (no GUI installation, no Vagrant) Shared folder with Virtual Box. If I just turn on my machine and run php artisan dusk , I get the following: [08:14 AM]-[root@php7]-[/var/www/html/admin]-[git master] # php artisan dusk PHPUnit 5.7.11 by Sebastian Bergmann and contributors. E 1 / 1 (100%) Time: 25.91 seconds, Memory: 10.00MB There was 1 error: 1) Tests\Browser\LoginTest::it_should_see_email_error_message

Set up Laravel 5.4 with Dusk using phpunit.xml, .env.dusk.local, and an sqlite in-memory database

有些话、适合烂在心里 提交于 2019-12-01 16:42:24
The title says it all. I would like to know how to properly set up a new Laravel 5.4 project with Dusk, using an in-memory SQLite database. I can run the tests, but I get an error: "No such table: users" I have created a new Laravel 5.4 project Installed Dusk and added the Service Provider I'm using the test from the laravel docs that tests authentication. It already includes the DatabaseMigrations trait I can run the tests, and the first one works (navigating to the /login route) but the second where it tried to log in fails. I have added a .env.dusk.local which contains APP_ENV=local APP_KEY

Set up Laravel 5.4 with Dusk using phpunit.xml, .env.dusk.local, and an sqlite in-memory database

笑着哭i 提交于 2019-12-01 16:05:11
问题 The title says it all. I would like to know how to properly set up a new Laravel 5.4 project with Dusk, using an in-memory SQLite database. I can run the tests, but I get an error: "No such table: users" I have created a new Laravel 5.4 project Installed Dusk and added the Service Provider I'm using the test from the laravel docs that tests authentication. It already includes the DatabaseMigrations trait I can run the tests, and the first one works (navigating to the /login route) but the

laravel 5.4 : cant access Auth::user() in the __construct method

元气小坏坏 提交于 2019-12-01 15:07:43
问题 In previous versions of Laravel, in the controllers which I needed to access logged user in all the methods I used to do something like this: class DashboardController extends Controller { private $user ; function __construct(Request $request) { $this->middleware('auth'); $this->user = \Auth::user(); } function func_1(){ $objects = Objects::where('user_id' , $this->user->id )->get(); } function func_2(){ $objects = Objects::where('user_id' , $this->user->id )->get(); } function func_3(){

Unable To Connect Laravel to MailChimp (laravel 5.4)

你离开我真会死。 提交于 2019-12-01 14:07:53
I have to define List ID and MailChimp API Key in my .env file. I'm sure both are fine even I am not getting any error but email in not inserting in my List I installed https://github.com/spatie/laravel-newsletter ( spatie/laravel-newsletter ) Package. Here is my method public function subscribe(Request $request) { $email = request('email'); Newsletter::subscribe($email); Session::flash('subscribed', 'Successfully subscribed.'); return redirect()->back(); } Then I check subscribe Method in Newsletter.php it is as public function subscribe($email, $mergeFields = [], $listName = '', $options = [

Unable To Connect Laravel to MailChimp (laravel 5.4)

删除回忆录丶 提交于 2019-12-01 13:21:47
问题 I have to define List ID and MailChimp API Key in my .env file. I'm sure both are fine even I am not getting any error but email in not inserting in my List I installed https://github.com/spatie/laravel-newsletter ( spatie/laravel-newsletter ) Package. Here is my method public function subscribe(Request $request) { $email = request('email'); Newsletter::subscribe($email); Session::flash('subscribed', 'Successfully subscribed.'); return redirect()->back(); } Then I check subscribe Method in