So I have this blog website which each blog post information is get from the admin user. In admin create post view I have a text area for the title which I can easily set its data to database by giving it a name, but then I have these buttons in my view(one for inserting ..
Category : mysql
I create new command in laravel: public function handle() { $serversList = [ ‘cubegame.pl’, ‘feerko.pl’, ‘skyup.pl’, ‘mcosada.pl’, ‘dragon-craft.pl’, ‘gc2.pl’, ‘mc.craftplay.pl’, ‘iskyblock.pl:25600’, ‘mc.craftmc.pl’, ‘mc.realcraft.pl’, ‘katomc.pl’, ‘mc.minestar.pl’, ]; foreach ($serversList as $server) { $req = Http::get("https://api.mcsrvstat.us/2/$server"); if ($req->ok()) { $status = $req->json(); // dump($status[‘motd’][‘html’][0]); $serv = Server::updateOrCreate( [ ‘name’ => $server, ‘ip’ => $status[‘ip’] ], [ ‘motd’ ..
How I can associate business with employees and owner (User table but using roles like Admin/Owner/Manager/Employee) and branches? public function getIsAdminAttribute() { return $this->hasRole(‘administrator’); } public function getIsOwnerAttribute() { return $this->hasRole(‘owner’); } public function getIsManagerAttribute() { return $this->hasRole(‘manager’); } public function getIsEmployeeAttribute() { return $this->hasRole(’employee’); } So I can know who is owner of business ..

I have a MySQL in the following format. I want to duplicate the entries in this table[products] [filtered by event_id] to another table [user_products]. What is the best approach to do this? In the user_products table while inserting the records, i will also have to add a user_id which gets passed to the code from ..
I have 2 columns id = [10 , 22 , 31]; and loction_url = [123.456 , 654.325 , 632,983]; i want data into a single array like this $a = [10 => 123.456 , 22 => 654.325 , 31 => 632,983]; here is my query which only gets columns $customers = Customer::whereIn(‘created_by’, $adminot)->select(array(‘id’ , ‘location_url’))->get(); ..

Before downvoting this question please let me know how I can improve the question. The problem? I created a constraint in my SQL database to prevent duplicate entries. The initial laravel form submission works fine. I get back the correct message. When I try to throw a duplicate entry, the app, as expected, throws an ..
I am new to laravel and building my first project using it. I want to query two tables (Cases and Detail) using orWhere() function. Please tell me the changes I need to make in my existing code. Controller.php $key = trim($request->get(‘q’)); $cases = Cases::query() ->where(‘cnic’, "$key") ->orWhere(‘eventDate’, "$key") ->get(); return view(‘adminHome’,[‘user’ => $cases ]); The ..
I am very thank full if anyone help me to resolve this issue. Detail: I have a mysql table where 110000+ record stored with Unique application(column) number. Now there is another API which will take only 1 application at a time in URI parameter and return detail of that application number it will take Approx ..
Here I am little bit confuse about my methodology is correct or not I want to use two different databases in same Laravel project one is to collect data and second one is for other operation. For collection of data I am creating API and calling it in same project just for code separation of ..
What would be the best way to implement authentication in laravel if I already have my users table (I imported it through an sql dump) and cannot modify its structure? I don’t have any model for this new table. Also the fields in my custom table are different from the default user table from laravel ..
I am having those two table Schemas (Client and Product Models) with a One to Many relationship. I am using mysql database. Schema::create(‘clients’, function (Blueprint $table) { $table->id(); $table->string(‘name’); $table->string(‘job’); $table->timestamps(); }); Schema::create(‘products’, function (Blueprint $table) { $table->id(); $table->foreignId(‘client_id’)->constrained(); $table->string(‘productName’)->unique(); $table->integer(‘quantity’); $table->float(‘unitPrice’); $table->timestamps(); }); I also tried to use the syntax below instead of $table->foreignId(‘client_id’)->constrained(); ..
I have several tables I need help to generate a query string, I am currently querying each of the table and combining the results in the frontend which is making too many requests to the backend Below are the structure of my tables users table id first_name last_name 1 John Doe 2 Peter Parker events ..
Migrations fails when I try to execute php artisan migrate and php artisan migrate:refresh Code Users Table (Migrated successfully) public function up() { Schema::create(‘users’, function (Blueprint $table) { $table->integer(‘id’,)->primary(); $table->string(‘name’, 255); $table->string(‘surname’, 255); $table->string(’email’, 255)->unique(); $table->string(‘password’, 255); $table->string(‘profile_image’, 255); $table->string(‘profile_cover’, 255); $table->rememberToken(); $table->char(‘token’, 255)->unique()->nullable()->default(null); $table->enum(‘role’, [‘user’, ‘driver’, ‘,merchant’, ‘storemanager’, ‘storeoperator’, ‘company’, ’employee’]); $table->dateTime(‘created’); $table->dateTime(‘updated’); }); ..
I have a users table Schema::create(‘users’, function (Blueprint $table) { $table->id(); $table->string(‘name’); $table->string(’email’)->unique(); $table->timestamp(’email_verified_at’)->nullable(); $table->string(‘password’); $table->rememberToken(); $table->timestamps(); }); and a roles table Schema::create(‘roles’, function (Blueprint $table) { $table->id(‘role_id’); $table->string(‘role_name’); }); now i want to create a user_role table which have two foreign keys Schema::create(‘user_role’, function (Blueprint $table) { $table->foreign(‘user_id’)->references(‘id’)->on(‘users’); $table->foreign(‘role_id’)->references(‘role_id’)->on(‘roles’); }); but i’m getting an ..
I’m Running the following query without any problem in Mysql Database but it throws error on server which database is MariaDB $projects = V2Project::leftJoin(‘v2_project_locations as v2pl’, ‘v2pl.project_id’, ‘v2_projects.id’) ->leftJoin(‘v2_locations as v2l’, ‘v2l.id’, ‘v2pl.location_id’) ->selectRaw(‘v2_projects.id, v2_projects.name, group_concat(v2l.name) as locations’) ->withDepartmentInMind() ->onlyAuthorizedObjects(); if($by_current_step == true) { $projects = $projects->where(‘current_step’, ‘plan’); } if($search_val) { $projects = $projects->whereIn(‘v2_projects.id’, $search_val); ..
$products = product::select([ DB::raw(‘product_no as number’), DB::raw(‘product_name as name’), DB::raw(‘sum(total) as total’), DB::raw(‘sum(product_qty) as qty’), DB::raw(‘sum(product_price) as price’), ]) ->groupBy(‘number’) ->groupBy(‘name’) ->get(); return view (‘view’,[‘products’=>$products]); i need to insert the result to another table in database by laravel Sourc..
I have two type of products. Book and cd. Book has number of pages and cd has playlength. I kept a condition for edit, update and delete and it’s working fine. In index function of Product Controller, I showed all products and its showing but when I need to display it in product.blade.php what condition ..

We’re starting a Laravel API from scratch where each user has his own MYSQL server (Amazon RDS instance). The user’s databases list will be less than 100 users, so less than 100 databases instances. We’re discussing with my partner because he’s storing each server settings in the .env file (APPROACH_1), he has a script that ..
I m using Laravel : 8.^0. After a few migrations i m trying to run php artisan schema:dump to generate an sql file. But i m getting the below error mysqldump: unknown variable ‘column-statistics=0’ mysqldump: unknown variable ‘set-gtid-purged=OFF’ SymfonyComponentProcessExceptionProcessFailedException The command "mysqldump –user="${:LARAVEL_LOAD_USER}" –password="${:LARAVEL_LOAD_PASSWORD}" –host="${:LARAVEL_LOAD_HOST}" –port="${:LARAVEL_LOAD_PORT}" –skip-add-locks –skip-comments –skip-set-charset –tz-utc –set-gtid-purged=OFF "${:LARAVEL_LOAD_DATABASE}" –routines –result-file="${:LARAVEL_LOAD_PATH}" –no-data" ..
Let’s assume that I have 2 tables: Users: Schema::create(‘users’, function (Blueprint $table) { $table->increments(‘id’); $table->string(‘name’); $table->string(’email’)->unique(); $table->integer(‘age’) $table->string(‘password’); $table->rememberToken(); $table->timestamps(); }); Phones: Schema::create(‘phones’, function (Blueprint $table) { $table->increments(‘id’); $table->integer(‘user_id’)->unsigned(); $table->string(‘phone’); $table->timestamps(); $table->foreign(‘user_id’)->references(‘id’)->on(‘users’) ->onDelete(‘cascade’); }); User Model: public function phone() { return $this->hasOne(‘AppPhone’); } Phone Model: public function user() { return $this->belongsTo(‘AppUser’); } When I perform ..

I’m trying to select the rows on the following table. I’m given 2 post_id and based on that I will need to select table rows that have matching topic_type and topic_id. On the table given below: I’m given post_id 5566 and 5574. Now, I need to select rows that match the value of topic_type and ..
I’m using Laravel, MySQL, and TablePlus to host my website. I’ve begun to code a login/sign-in page, however, it’s not showing the result of the HTML code when I try to view the page on the hosting website. The filename of the code is "signin.blade.php" and I have basic HTML code within it. Furthermore, when ..

Currently in a Laravel project using AWS EB with RDS. When I run php artisan migrate –seed then I get PHP Notice: Undefined index: RDS_HOSTNAME in /var/app/current/config/database.php on line 5 PHP Notice: Undefined index: RDS_USERNAME in /var/app/current/config/database.php on line 6 PHP Notice: Undefined index: RDS_PASSWORD in /var/app/current/config/database.php on line 7 PHP Notice: Undefined index: RDS_DB_NAME ..
What is the ideal method for me to put unlimited social media links on my contact page? my sql table: contact_social id|title |url 1|facebook| bla bla 2|twitter | bla bla How can I select specific links on the client side? contact_social[‘title’] = No way contact_social[‘url’] = which url other way id|facebook|twitter 1|bla bla |bla bla ..
I have two models using different tables on two different connections, User and UserInfo. User has a UserInfo hasMany relation: public function userInfo() { return $this->hasMany(‘pathtoUserInfo’,’User_ID’); } and UserInfo has a User belongsTo relation: public function user() { return $this->belongsTo(‘anotherpathtoUser’, ‘User_ID’, ‘User_ID’); } I would like to find the first user with more than one ..