laravel-5.2

Laravel - append a trailing slash in routes

不想你离开。 提交于 2019-12-05 02:23:37
问题 As I mentioned several times here, I'm redoing one of my old sites with Laravel. Another problem I encounter is the following : I've got mainly two different types of urls on the old website : /user-slug/ for the users homepage, and /user-slug/content-slug.html for one of its content I managed to recreate the second one, but Laravel always trims the last slash when I try to create a link to the user route, and I end with an url like /user-slug I don't want to lose any SEO when switching the

How could i create carbon object from given datetime structure?

坚强是说给别人听的谎言 提交于 2019-12-05 00:52:32
I use laravel, i need to create carbon object from the timestamp that i received. TimeStamp : ' yy-mm-dd HH:mm ' ex. ' 2016-12-20 10:26 ' Is this possible ? Or Any other solution ? Use Carbon::parse('2016-12-20 10:26'); , it will return a Carbon object. Based on carbon doc , you can convert date string to carbon object like: 1) Carbon::parse('1975-05-21 22:23:00.123456') 2) Carbon::create($year, $month, $day, $hour, $minute, $second, $tz); You can use parse() : Carbon::parse($dateString); Or you can use $dates property to create Carbon instance automatically for the column: protected $dates =

Laravel 5.3 Passport Custom Grants?

耗尽温柔 提交于 2019-12-05 00:51:53
I know I am not the only person who has come up to this point. Does anyone know how to properly implement a custom grant in Laravel(5.3) Passport? Or Have a good link/tutorial to reference how to properly do it? I know there's this package: https://github.com/mikemclin/passport-custom-request-grant But I'm asking for a more "Do it yourself" approach. Thank you in advance. Francisco Daniel namespace App\Providers; use App\Auth\Grants\FacebookGrant; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; use Laravel\Passport\Bridge\RefreshTokenRepository; use Laravel

URL Blocked: This redirect failed because the redirect URI is not whitelisted…(Localhost web application)

ε祈祈猫儿з 提交于 2019-12-05 00:15:47
URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs. I've installed the laravel/socialite and I'm trying to link my application with facebook ! after installing the package ,creating my facebook application , I try to acces to the login page with facebook on my application but it keeps telling me that ther's some kind of URL errors ... ??? any ideas.? It's redirect URL problem. Facebook automatically generates a redirect URL which

How to use web and api guards at the same time in Laravel?

不想你离开。 提交于 2019-12-04 22:43:29
I have build application with two parts: RESTful part for mobiles and web. How can I use web/api guards at the same time? That I can register users with stadart web form, and accept request like as Restful? Protect whatever routes are for your api with auth:api middleware Route::group(['middleware' => ['auth:api']], function(){ //protected routes for API }); We must make sure that your users table has an api_token column: php artisan make:migration alter_users_table_add_api_token_column Then inside of the up function: Schema::table('users', function($table){ $table->string('api_token', 60)-

How to display a table in a popup box with JavaScript?

假装没事ソ 提交于 2019-12-04 22:23:39
I have the form below, with 4 comboboxes "Metier" "tache" "tacrification" et "technicien", I select a Metier and a tache, after this I want that a popup box appears and show me a table that contains all the "techniciens" and their "tarification" (of course only the "techniciens" that are related with the "tache" already selected.) After this I select a "technicien" from that table a now the form is completely filled with the "technicien" and it's "tarification". iterventioncontroller public function create() { $client = client::orderBy('id', 'asc')->get(); $metiers = metier::orderBy('id', 'asc

Call to undefined method Illuminate\\Database\\Query\\Builder::notify()

筅森魡賤 提交于 2019-12-04 22:20:19
Issue in Laravel 5.3.6 when submitted request in Forgot Password. Error Details Call to undefined method Illuminate\Database\Query\Builder::notify() Issue is in below file: vendor\laravel\framework\src\Illuminate\Auth\Passwords\PasswordBroker.php Line 69. Code is below $user->sendPasswordResetNotification( $this->tokens->create($user) ); Function: sendResetLink It was working fine in Laravel 5.2 and seems not working in 5.3.6 version. Have you faced this issue? Bestmomo Momo You must add Illuminate\Notifications\Notifiable trait in User model. Add the Notifiable trait in your User mode.

Laravel migration default value

给你一囗甜甜゛ 提交于 2019-12-04 22:15:24
I didn't understand what is the effect of the default option in the migrations. I can see that the column in the database is defined with default value, but the models are ignore it completely. Say I have a Book model that reflect the books table in the database. I have migration to create the books table: Schema::create('bools', function (Blueprint $table) { $table->increments('id'); ->string('author'); ->string('title'); ->decimal('price', 4, 1)->default(100); ->timestamps(); }); When I create a new instance of Book model I see: $book = new Book(); var_dump($book->price); //Always 0... The

Laravel valet not working

青春壹個敷衍的年華 提交于 2019-12-04 20:51:39
问题 I use OSX El Capitan and PHP 7. I followed the installation guide so I install Laravel Valet version v1.1.3 successfully. I ping foo.dev or any.dev then the terminal prints "64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.116 ms" Everything is ok. My directory /User/mickey/Sites is added to Valet's paths. I created a Laravel 5.2 project named blog, then run the project with php artisan serve ok but when i accessed url blog.dev on the browser, the browser said This site can’t be reached,

Argument 3 passed to GuzzleHttp\Client::request() must be of the type array, string given

不问归期 提交于 2019-12-04 20:23:30
问题 I'm experimenting with SammyK/LaravelFacebookSdk. Trying to run this line from example: $response = Facebook::get('/me?fields=id,name,email', 'user-access-token'); which in turn runs /var/www/vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookGuzzleHttpClient.php line 61 public function send($url, $method, $body, array $headers, $timeOut) { $options = [ 'headers' => $headers, 'body' => $body, 'timeout' => $timeOut, 'connect_timeout' => 10, 'verify' => __DIR__ . '/certs