User Login

Please enter user name and password into following boxes!

If you are not registered yet, please click

Forget Password

If you forget your password, please click

php

  • Laravel Seeding in Detail

    Associate User with same role: factory(\App\Models\User::class, 'random', 50)->create()->each(function ($u, $value) { if ($value == null) $value = factory(App\Models\Role::class, 'satici')->make(); else $value = \App\Models\Role::where(['name'=>'satici'])->firstOrFail(); $u->roles()->save($value); });...Continue Reading

    Enable Sql Log in Laravel

    Event::listen('Illuminate\Database\Events\QueryExecuted', function ($query) { if (App::environment() == 'local') { Log::info($query->sql . ' Parameters: ' . serialize($query->bindings)); } });...Continue Reading

    Php Laravel Framework Remove index.php From Url

    Removing index.php from url in Laravel project use following .htaccess commands after RewriteRule ^ index.php [L] RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L] Full htaccess File <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On # Redirect Trailing Slashes If Not A Folder... RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUE...Continue Reading

    How to Select Categories in Php Web App?

    Category table: id adi url parent 1 Elektronik elektronik NULL 2 Laptop laptop 1 We can use following codes to extract parent->child category array: /** * Show the application dashboard. * * @return \Illuminate\Http\Response */ public function index() { $categories = DB::table('kategori as k1') ->join('kategori as k2', 'k1.id', '=', 'k2.parent') ->select('k1.adi as parent_adi', 'k1.url as parent_url', 'k2.adi as child_adi', 'k2.url as child_url') ->get(); $parents = array()...Continue Reading

    How to use DB Transaction with Repository Pattern in Laravel?

    In Laravel framework, we can use following transaction block with repository pattern and classic eloquent usage: DB::transaction(function () use ($talep, $input,$id) { UrunTalep::where('talep_id', '=', $talep->id)->forceDelete(); $talep = $this->talepRepository->update($input, $id); });...Continue Reading

    OneSignal Push Notification Send to Specific User in PHP

    $content = array( "en" => $message//mesaj burasi ); $fields = array( 'app_id' => "e3b90484-e534-4a11-9b87-3b9c2fbd413", 'included_segments' => array("Active Users", "Inactive Users"), 'data' => array("foo" => "bar"), 'filters' => array(array('field' => 'tag', 'key' => 'userId', 'relation' => '=', 'value' => $userId)), 'contents' => $content ); $fields = json_encode($fields); print("\nJSON sent:\n"); print($fields); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/notifications"); curl_setopt($ch, CURLOPT_HTTPHEADER, arra...Continue Reading

    PHP OneSignal Push Notification Send to Specific User

    $content = array( "en" => $message//mesaj burasi ); $fields = array( 'app_id' => "e3b90484-e534-4a11-9b87-3b9c2fbd413", 'included_segments' => array("Active Users", "Inactive Users"), 'data' => array("foo" => "bar"), 'filters' => array(array('field' => 'tag', 'key' => 'userId', 'relation' => '=', 'value' => $userId)), 'contents' => $content ); $fields = json_encode($fields); print("\nJSON sent:\n"); print($fields); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/notifications"); curl_setopt($ch, CURLOPT_HTTPHEADER, arra...Continue Reading

    MSSQL Server UTF-8 Connection in PHP

    We can connect msql server as follows: $serverName = "127.0.0.1"; $uid = "sa"; $pwd = "123456!"; $databaseName = "TEST"; $connectionInfo = array("UID" => $uid, "PWD" => $pwd, "Database" => $databaseName, "CharacterSet" => "UTF-8"); //Connect using SQL Server Authentication. $conn = sqlsrv_connect($serverName, $connectionInfo); $tsql = "SELECT * FROM fatura"; // Execute the query. $stmt = sqlsrv_query($conn, $tsql); $row = sqlsrv_fetch_array($stmt); if (stmt) { echo "Statement executed"; } else { echo "Error in statement execut...Continue Reading

    Onesignal Rest API Push Notification in Wordpress PHP

    We can use following wordpress codes to send notification in OneSignal: $body = new stdClass(); $body->app_id = "31ee45e2-c63d-4048-903a-89ca43f3afa4"; $body->contents = array('en' => 'merhaba'); $body->filters = array(array('field' => 'tag', 'key' => 'authorID', 'relation' => '=', 'value' => '54')); $bodyAsJson=json_encode($body); $response=wp_remote_post("https://onesignal.com/api/v1/notifications", array( 'method' => 'POST', 'timeout' => 45, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true,...Continue Reading

    "Data source name not found and no default driver specified" error on connecting using ODBC applications in PHP

    If you get "Data source name not found and no default driver specified" error on connecting using ODBC applications exception check connection string same as follows: $connStr = 'odbc:Driver={Microsoft Access Driver (*.mdb)};' . 'DBQ=C:\xampp\htdocs\efarmasi\Ayahya.mdb;Uid=; Pwd=;';...Continue Reading