laravel-5.2

Laravel 5.2 Intervention Image 500 Server Error

喜夏-厌秋 提交于 2019-12-07 00:36:56
问题 When I upload big images (4.2 MB) Intervention Image is throwing 500 Error... private function resizeImage($path, $imgName){ $sizes = getimagesize($path.$imgName); if($sizes[0] > $sizes[1]){ ImageManagerStatic::make($path.$imgName)->fit(920,474)->insert(public_path() . "/uploads/applications/watermark.png",'bottom-right', 30, 30)->save($path."1_".$imgName); }else{ ImageManagerStatic::make($path.$imgName)->heighten(474)->insert(public_path() . "/uploads/applications/watermark.png",'bottom

Exclude route from Laravel authentication

你。 提交于 2019-12-06 23:57:40
问题 After running php artisan make:auth all the required routes are in the route.php file, but is it possible to remove one (I want to remove the register route)? Currently I have Route::group(['middleware' => 'web'], function () { Route::auth(); }); I know that Route::auth() is a shortcut to add all the routes. Should I specify the routes myself instead of using the shortcut? 回答1: Unfortunately you can't exclude register with the current implementation of Route::auth(). You would have to specify

Pluck with multiple columns?

ぃ、小莉子 提交于 2019-12-06 22:34:02
问题 When i use pluck with multiple columns i get this: {"Kreis 1 \/ Altstadt":"City","Kreis 2":"Enge","Kreis 3":"Sihifeld","Kreis 4":"Hard","Kreis 5 \/ Industriequartier":"Escher Wyss","Kreis 6":"Oberstrass","Kreis 7":"Witikon","Kreis 8 \/ Reisbach":"Weinegg","Kreis 9":"Altstetten","Kreis 10":"Wipkingen","Kreis 11":"Seebach","Kreis 12 \/ Schwamendingen":"Hirzenbach" But i need this? ["Rathaus","Hochschulen","Lindenhof","City","Wollishofen","Leimbach","Enge","Alt-Wiedikon","Friesenberg","Sihifeld"

How could i create carbon object from given datetime structure?

女生的网名这么多〃 提交于 2019-12-06 19:28:41
问题 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 ? 回答1: Use Carbon::parse('2016-12-20 10:26'); , it will return a Carbon object. 回答2: 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); 回答3: You can use parse() : Carbon::parse(

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

送分小仙女□ 提交于 2019-12-06 17:23:53
问题 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? 回答1: 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

Laravel sql search json type column

放肆的年华 提交于 2019-12-06 17:04:32
The mysql has table 'subscribe' table and it's as follows: column type id int condition json type_id id and the example as follows: "id": "1", "condition": "{\"id\":\"2\",\"class\":\"master\",\"zone\":\"west\",\"price\":\"511\"}", "type_id": "1" and I want to select the column which match in the column condition like "zone"="west" the laravel 5.2 has support the order $subscribe = DB::table('subscribe')->where('condition->class', 'master')->get(); Error Column not found: 1054 Unknown column 'condition->class' in 'where clause'( SQL: select * from `subscribe` where `condition->class` = master)

Laravel 5 on IIS7 does not work with web.config

夙愿已清 提交于 2019-12-06 16:47:43
I have a simple Laravel 5 app. It was developed on Xampp, and worked perfectly. I copied it onto the production server, and it does not work. Something is wrong with the web.config file, because if I remove it, then the app works perfectly with index.php/path My webconfig is as follows: <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="Rule 1" stopProcessing="true"> <match url="^(.*)/$" ignoreCase="false" /> <action type="Redirect" redirectType="Permanent" url="/{R:1}" /> </rule> <rule name="Rule 2" stopProcessing="true"> <match url="^"

Laravel migration default value

早过忘川 提交于 2019-12-06 16:31:58
问题 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

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

♀尐吖头ヾ 提交于 2019-12-06 15:25:12
问题 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

Laravel 5.2: Undefined class form

女生的网名这么多〃 提交于 2019-12-06 15:17:47
问题 I have a problem with using Form command in a Composer + Laravel 5.2 project with PhpStorm as IDE. I'm using Laravel Collective 5.2. in my composer.json , so it should work. (sadly, it's not which is the reason I'm here...) The providers: Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class, Collective\Html\HtmlServiceProvider::class, my aliases. 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class, The problem: It's returned as a undefined class when