#### Category : mysql

I am currently implementing Ldap Record I can do the login, however when displaying any results on my index page I have a relationship between an Activity and Users model where I am displaying the activity created by whom. when removing the column which shows the Logged By Activity I can display the index page ..

first time I ask via the web, but I don’t know what I can do anymore. My question is about laravel using Eloquent. I have no problems with migrations and seeding and have a connection to MySQL. But when I try to build a controller and want to store data on my existing table car. ..

Im a new to php server, i have a question I am making a server in php, and i am reading data from DB mysql server, but i get an error that is every time i echo out $this->connection my program is stopped, which means it will execute the statements before the echo "successful connection" .. Read more how do I hasMany relationship, get the last 5 users, I try to use model and witch hasMany the relation appears empty. I have already done many tests, I always have problems with the relationships when obtaining the last 5 users in each query Query:$minute = Minute_Report::Query()->whereBetween(‘minutos.fecha’, [$from,$to]) ->join(‘clients’, ‘minutos.cliente’, ‘=’, ‘clients.id’) ->join(‘users ..

I don’t know the technical terms of the LAMP stack very well so I will try to explain myself as much as I can. I have my project in my local Ubuntu (running on Windows 10 pro). I ran docker from WSL and I edited the default Laravel Sail docker-compose file. my env file is ..

I’m working with Laravel 8 to develop my project and I have made this Migration: public function up() { Schema::create(‘activation_codes’, function (Blueprint $table) {$table->id(); $table->unsignedBigInteger(‘user_id’);$table->foreign(‘user_id’)->references(‘id’)->on(‘users’)->onDelete(‘cascade’); $table->string(‘code’);$table->boolean(‘used’)->default(false); $table->dateTime(‘expire’);$table->timestamps(); }); } And at the Model I added this: protected $fillable = [‘user_id’,’code’,’used’,’expire’]; public function scopeCreateCode($query, $user) {$code = $this->code(); return$query->create([ ‘user_id’ ..

What is the problem with this part of my code? Sourc..

Iam doing project of PHP and Mysql right now. And i need to insert unique userid to each row. It should be less 5-6 char and including num and char Its must should be unique Sourc..

I’m new to Laravel. Can anyone please let me know how to use "AS" operator for table ‘products’ in below SQL query? $obj = new Product();$main_data = $obj ->select(‘products.*’,’t2.title’) ->leftJoin(‘category as t2’, ‘t2.id’, ‘=’, ‘products.subcategory_id’) ->where(‘products.status’,1); Sourc.. Read more I have a raw php code which promote students from one grade to another upon a submission and it works fine. I want to use Laravel to do that and I seem not to get it. I need assistance and to learn from it. public function updateClass() {$QueryStudent = " UPDATE students SET CurrentClass ..

I have the following eloquent collection: $cars = Car::with([‘model’])->get(); I also have a mysql stored procedure that calculates some measure based on a date range:$getMeasure = DB::select( ‘CALL measure("’.$start_date.’", "’.$end_date.’")’ ); The two columns resulted from the procedure are car_id and measure. Is it possible when selecting the cars to also get the measure ..

I have 2 tables, one with different users, and the second table is an invoice table called "factures" and has a foreign key of userid, I called it client_id, which I am trying to get is the number of clients created_by a certain administrator and who have no invoices yet, here is what I tried: ..

I have records in a database with three different records in a particular column. I am trying to fetch all the records using Laravel but I am not getting it right after trying with multiple methods and each method is fetching only one record. I would be glad if I get assistance and to also ..

I am trying to copy the data from one database to another database on a different server. The databases are identical in structure. From searching around I have tried using the insertUsing() method in Laravel. $new_connection = DB::connection(‘mysql2’); //Insert Using requires an array of columns$column_list = Schema::getColumnListing(‘users’); //This is my select statement $select = .. Read more I need to get user id of 2nd generation user’s referred user . example current user – johndoe (id – 33) his sponsor – kojoe ( id – 30 ) kojoe sponsor – admin (id -1 ) I get johndoe sponsor id(kojoe id) by$user = User::find(Auth::id()); $ref_id =$user->referrer_id; $ref_user = User::find($ref_id); I need ..
I’m new on this subject, I have one table called Users and that has a column called department_id I have another table called tasks and it has a column called user_id and completed_at I would like to know how many tasks were completed by each department please help me to do it in laravel foreach($departments .. Read more I’m new on this subject, I have one table called Users and that has a column called department_id I have another table called tasks and it has a column called user_id and completed_at I would like to know how many tasks were completed by each department please help me to do it in laravel Query .. Read more I want to insert " [email protected]#$%^&*()?<>:| " this string into my table but when I hit save it inserts only this much in table [email protected]#$%^, rest of the characters doesn’t store in the table. Here is my laravel controller code public function store(Request$request) { $x =$request->get(‘task_name’); DB::insert(‘insert into tasks (task_name) values (?)’, [$x]); .. Read more My Laravel application (version 5.0.33) has suddenly started throwing the following error: local.ERROR: exception ‘PDOException’ with message ‘SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.’ .. Read more i work on a laravel project. I want migrate new migrations but an old migration block me. I’m on laravel 8 and PHP 8. SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use .. Read more how i can get data from modal which already checked here is my modal <div class="modal fade" id="modalTT" tabindex="-1" role="dialog" aria-labelledby="staticBackdrop" aria-hidden="true"> <div class="modal-dialog modal-dialog-scrollable modal-xl" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">add</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <i aria-hidden="true" class="ki ki-close"></i> </button> </div> <div class="modal-body"> <div class="table-responsive"> <table class="table table-hover table-borderless cssTable"> <thead .. Read more SELECT * FROM nav_subs LEFT JOIN (SELECT * FROM nav_accesses WHERE user_id = 3) AS navaccess ON navaccess.sub_id = nav_subs.id WHERE user_id IS null; Sourc.. Read more I hosted my Laravel project on Namecheap but its displaying HTTP ERROR 500, when I complained to the Namecheap customer service, they showed me the error log message: PHP Fatal error: Uncaught Error: Call to undefined method IlluminateSupportCollection::getArrayableItems() in /home/kroooaux/kroofing/vendor/laravel/framework/src/Illuminate/Collections/Collection.php:31 The project is working perfectly offline with my Xampp but I don’t know why it’s .. Read more I’m using an MySQL database to store the input of a HTML tag: . I want to fill in some HTML input fields with some Java by doing the following: <script> document.getElementById(‘ownName’).value = "{{$userFirstName}} {{$userSurname}}"; document.getElementById(‘ownEmail’).value = "{{$userEmail}}"; document.getElementById(‘managerName’).value = "{{$managerFirstName}} {{$managerLastName}}"; document.getElementById(‘managerEmail’).value = "{{\$managerEmail}}"; </script> The script as it stands above is inserted in ..