laravel-5.6

Laravel: Display data in DropDown from database

安稳与你 提交于 2020-04-18 12:21:07
问题 I was developing a project with Laravel and want to use dropdownlist and populate it with data from database please help. Here is the code that I use: Controller: public function create() { $items = Income::pluck('name', 'id'); return view ('IncomeExpense.create'); } View: <div class="form-group"> {{Form::label('', 'Category')}} {{Form::select('IncomeExpense',null, $items,['class'=>'form-control', 'placeholder'=>'Choose category'])}} </div> 回答1: First of all, you have an error in your

Your requirements could not be resolved to an installable set of packages. Laravel 5.6?

可紊 提交于 2020-04-16 02:57:08
问题 Here is the screenshot of the CMD Error message in CMD: Problem 1 - Conclusion: don't install laravel/framework v5.6.29 - Conclusion: don't install laravel/framework v5.6.28 - Conclusion: don't install laravel/framework v5.6.27 - Conclusion: don't install laravel/framework v5.6.26 - Conclusion: don't install laravel/framework v5.6.25 - Conclusion: don't install laravel/framework v5.6.24 - Conclusion: don't install laravel/framework v5.6.23 - Conclusion: don't install laravel/framework v5.6.22

Your requirements could not be resolved to an installable set of packages. Laravel 5.6?

你离开我真会死。 提交于 2020-04-16 02:57:05
问题 Here is the screenshot of the CMD Error message in CMD: Problem 1 - Conclusion: don't install laravel/framework v5.6.29 - Conclusion: don't install laravel/framework v5.6.28 - Conclusion: don't install laravel/framework v5.6.27 - Conclusion: don't install laravel/framework v5.6.26 - Conclusion: don't install laravel/framework v5.6.25 - Conclusion: don't install laravel/framework v5.6.24 - Conclusion: don't install laravel/framework v5.6.23 - Conclusion: don't install laravel/framework v5.6.22

Laravel 5 WebPack JQuery - $ is not defined

一笑奈何 提交于 2020-02-24 00:47:13
问题 I Have webpack.min.js: mix.webpackConfig(webpack => { return { plugins: [ new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', 'window.jQuery': 'jquery', Popper: ['popper.js', 'default'], }) ] }; }); mix.sass('resources/assets/styles/index.scss', 'public/css/app.css') .js('resources/assets/scripts/index.js', 'public/js/app.js') .copyDirectory('resources/assets/static', 'public/static') .version() .sourceMaps(); and package.json: "devDependencies": { "jquery": "^3.3.1", "axios": "^0.18.0

Laravel drop foreign Key in Migration

。_饼干妹妹 提交于 2020-01-24 03:45:13
问题 I want to create a Migration which shall drop a table. I created the Migration like this: Schema::table('devices', function (Blueprint $table) { $table->increments('id'); $table->unsignedInteger('client_id')->nullable(); $table->foreign('client_id')->references('id')->on('clients')->onDelete('cascade'); }); And now I try to drop it like this: Schema::table('devices', function (Blueprint $table) { $table->dropForeign('devices_client_id_foreign'); $table->drop('devices'); }); But I get

How can I add, delete and get a favorite from product with polymorphic relationship, in Laravel 5.6?

只愿长相守 提交于 2020-01-21 20:09:08
问题 My product model like this : <?php ... class Product extends Model { ... protected $fillable = ['name','photo','description',...]; public function favorites(){ return $this->morphMany(Favorite::class, 'favoritable'); } } My favorite model like this : <?php ... class Favorite extends Model { ... protected $fillable = ['user_id', 'favoritable_id', 'favoritable_type']; public function favoritable() { return $this->morphTo(); } } My eloquent query laravel to add, delete and get like this : public

How do you create a custom 404 page in Laravel 5.6?

扶醉桌前 提交于 2020-01-21 19:53:50
问题 I have not found any tutorials out there that address how to "properly" create a 404 page in this specific version of Laravel 5.6. I found some outdated once that is a bit different that how Laravel 5.6 works. Any inputs will help. 回答1: I found the answer by reading the Laravel Docs "Custom HTTP Error Pages". Create a "Errors" Folder under "/resources/views/" and create a file named "404.blade.php" then add this code: @extends('../layouts.app') @section('content') <div id="login-container"

How can I call command schedule via url on the laravel?

有些话、适合烂在心里 提交于 2020-01-17 15:25:10
问题 I using laravel 5.6 I set my schedule in the kernel.php like this : <?php namespace App\Console; use App\Console\Commands\ImportLocation; use App\Console\Commands\ImportItem; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { protected $commands = [ ImportLocation::class, ImportItem::class, ]; protected function schedule(Schedule $schedule) { $schedule->command('inspire')->dailyAt('23:00'); } protected

Laravel Session::getId() is different on login and logout

柔情痞子 提交于 2020-01-16 09:08:10
问题 i have table user_logins to maintain multiple login information about user table structure for user_logins : 'session_id', 'user_id', 'ip_address', 'user_agent', 'browser_name', 'location', 'login_at', 'is_active' i have UserEventSubscriber listener with 2 functions like below : public function handleUserLogin($event) { UserLogin::create([ 'session_id'=>Session::getId(), ... ]); } im getting Session::getId() = mpT6RDsl54JExkejrqf3fnYiFLzbR2pTb2qfNHBe in handleUserLogin function now when user

captcha form validation required error message in vue-recaptcha

你说的曾经没有我的故事 提交于 2020-01-11 06:38:12
问题 I am following this Package in vue.js and Laravel 5.6.7 to implement captcha. https://github.com/DanSnow/vue-recaptcha#install Component code in vue.js <template> <div> <vue-recaptcha v-model="loginForm.recaptcha" sitekey="My key"> </vue-recaptcha> <button type="button" class="btn btn-primary"> Login </button> </div> </template> <script> </script> app.js code import VueRecaptcha from 'vue-recaptcha'; Vue.use(VeeValidate); Vue.component('vue-recaptcha', VueRecaptcha); Question: Is there any