Category "laravel"

Make survey at laravel 5.4 and MySQL

I need to make a survey for my website. I have this: Route: Route::resource('survey','surveyController'); Controller: public function index() { $show=surve

There is no role named `admin`. laravel

i use this package : https://github.com/spatie/laravel-permission/tree/v2 code : $user=User::find(2); $user->assignRole('admin'); and when

Always have to clear cache in .env?

I am having a cache issue. I have a project and worked on local. Now whenever i upload to server and edit the .env and config/app.php file. It is not taking the

Log a user out of a website when they put their computer to sleep

This is a bizarre one. We have a Laravel website, and on said site we have a timer per user, where they get 15 minutes of being inactive before being booted. W

preventing abuse of API service usage

I am planning on using Laravel in my next web project, for the backend. Using the Laravel's built-in functionality I will build an API service. So my main conce

oauth-private.key does not exist or is not readable

So, I imported another project from Bitbucket and tried to launch it using php artisan serve, I always get this error: [LogicException]

Laravel: Create morphs() relationship nullable

I want to create a one-to-one polymorphic relation allow null relation. Example: Schema::create('ps_assistances', function (Blueprint $table) {

laravel using policy with many to many relationship pivot table

how do you set policy in many to many relationship since it is using pivot table ||laravel version 6|| Example:MainTable[company and user] PivotTable[company_u

Is it possible to use session from kernel console command in laravel?

I'm trying to fetch data from sessions when I run a command in my console, but session always returns an empty array! php artisan command:mycommand Below is

Laravel pass id to controller using AJAX

Route Route::post('approve', 'PostsController@approve'); javascript $(document).ready(function() { $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('

Parameter is not sent to Laravel route in Ajax

I'm working with Laravel 5.8 and I wanted to apply a discount code system for my site. So I tried sending data with Ajax like this: $.ajax({ type: 'POST',

Laravel Migration Error: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

Migration error on Laravel 5.4 with php artisan make:auth [Illuminate\Database\QueryException]

Laravel: Why is my variable not being set while it's in the construct function of the controller?

class Controller extends BaseController { use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests; private $host; private

Remove categories with all childs derived from parent category

I want to remove all related child categories from parent categories. I think I need a recursive function to solve this. Here is my attempt: public function de

Detect emoticons in string

I found that you need PHP 7 and MySQL 5.5 to use emoticons in a string that you want to upload to the database. I don't have these specification on my server s

I want to make where clause inside to select DB::raw in laravel

I have two tables biodata_wni and demographics, I want to count data where column akta_kwn in biodata_wni has value 1 and also the count of akta_kwn in biodata_

Saving Data from Laravel Form in Bootstrap Modal

i have a bootstrap modal dialog which use laravel form to register a user. Here's the code: <div id="addPenggunaModal" class="modal hide fade" tabindex="-1

SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'column_name' in Laravel

Laravel Multiple Data Insert Error SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column 'unit_id' at row 2 (SQL: insert into p

Laravel str_random() or custom function?

Is the Laravel str_random() function random enough so that I can use it for IDs? For example: str_random(32); This produces a random string of length 32 mad

Laravel env('APP_URL') is not returning the correct value for localhost

When trying to retrieve the APP_URL from the Laravel config it returns the wrong URL for development only. My env file has the following: APP_URL=http://127.